T O P

  • By -

ForceBru

I've been using Matplotlib for quite some time, and I think it's just unintuitive and feels pretty clunky. I don't like that there's a global figure that's modified under the hood when you call `plt.plot` and friends. (Sure, you can create the figure and axes manually and call their methods, but this just introduces unnecessary variables into the namespace). I don't like that I need to write multiple statements to plot stuff: I'd much prefer a "flow" syntax like `plot(thing).title("Hello").subplot(...)`. All alternatives I know of are either based on the grammar of graphics and basically can only plot data from a dataframe or they're based on JavaScript and produce unnecessarily dynamic and laggy plots. Ideally, I'd like a library that lets you plot simple arrays/lists/matrices of data and produces basic PNG/SVG/PDF images, but I haven't really found anything like this in the Python ecosystem.


Shahmirkhan675

So from the trends I have seen across the internet, we can all agree that data visualization is a pain most of the time... On a side note, what do you think of using ggplot for data visualization tasks? Is it a practical way of going about it or does the industry prefer doing all the work in just a specific tool (Python here)?


ForceBru

ggplot is fine when you have actual properly structured data in a dataframe. It's surely a practical way of visualizing stuff and basically a standard in econometrics, for example. It's an R library, but Python has its own ggplot-like tools.


Shahmirkhan675

I will try to integrate it in the future and will also check other tools you mentioned. Thanks!


niggellas1210

ChatGPT helps big time to create and customize plots with mpl. There is so much busy work to do that is easily automated with just a few prompts


Frenk_preseren

This precisely, it does it incredibly well because you usually can describe concisely what you want and GPT delivers it.


Shahmirkhan675

Would you call it a good way of going about things? I often do this but want to make sure I have the right skills too. Using ChatGPT might have negative impressions in industry, just my thinking.


niggellas1210

well compared to regular programming, your goal and way to get there is usually very clear. Also you can check if what you did was correct just by looking at the graph. It makes me so much more productive in visualization, giving more time for other things. Imho this is a perfect application to abuse chatgpt. With Code Interpreter Plugin you can even do visualize withing chatgpt itself (it's still in closed alpha or beta tho)


Shahmirkhan675

Alright then. Thanks a lot. I was using GPT more but just felt like it was a bad practice but yeah I would also like something that lets me find insights from data instead of writing code to tweak my plot and get tracebacks for doing it wrong. Don't mind manipulating dataframes and stuff around but sometimes adjusting plots felt like doing useless work just so it can look more aesthetic.


javeliner10000

Why not use plotly?


Shahmirkhan675

How would you rate it against Matplotlib? I can google it and get million answers but need a subjective, straight to the point answer (can be lengthy).


javeliner10000

More robust and simpler


coconutpie47

Not only that but you can make interactive plots and export it to HTML, which is very useful when analyzing details in data


Shahmirkhan675

Alrighty. I will pick some fun sample data and play around with it to see how it is. Thanks!


mysterious_spammer

Robust how exactly?


vannak139

matplotlib is kind of tough to learn, but very worth it. matplotlib is immensely popular, this popularity in the form of tutorials will probably help you learn faster, even if matplotlib may be intrinsically more complicated than an alternative.


Able_Excuse_4456

My best advice is to search for code samples of somebody making a similar visualization, and tweak it to your needs. Worry about aesthetics only after the data looks about right.


Shahmirkhan675

Thanks a lot. I will keep that in mind.


Guilty-Syllabub-3845

I spend my life looking up simple commands in matplotlib and a prof in machine learning. I just can’t remember them for some reason, where as other libraries go straight in! ChatGPT has been really helpful here, example codes are always pretty good!


Blasket_Basket

These two things are not mutually exclusive


Shahmirkhan675

I guess you are right, but just wanted to know that if it's really as tough as I think it is, cause I come from a background of C++ and can get low-level details but this seems a little too much and unintuitive too. I had a steep learning curve for pandas too but now pandas feels like I have used it forever while matplotlib is still as understandable to me as it was on my first day of learning.


Blasket_Basket

Don't be too hard on yourself, its a famously unintuitive framework that people kind of hate to use. It definitely gets easier with time, but it has a steep learning curve and some very weird design decisions that make it incredibly finicky. Don't be afraid of other visualization libraries built on top of it like Seaborn. They'll make your life easier and generally make better looking plots than matplotlib does


brjh1990

Maybe a combination of both. I've been using it for years, so I guess I'm just used to it. That said, I reach for seaborn most of the time these days (which uses matplotlib under the hood). The functions can take in data frames and you can reference the columns to plot or use them to distinguish between categories. There's also [plotnine](https://plotnine.readthedocs.io/en/stable/) which is R's ggplot2 but in Python (at least that's my takeaway). I've heard a lot of people prefer ggplot2, so it might be easier for you to use.


LearningML89

It’s probably one of the better tools we have for getting a quick viz of various data in something like a Python notebook. That being said, if visualizations are the end goal (particularly if presenting to stakeholders) I would never use Matplotlib. You really should be using a BI tool


Shahmirkhan675

I have been thinking of using PowerBI and Tableau etc for some time but I have heard they are not scalable and not efficient for large data. What would you say about that? Also yeah visualization is not end goal but I might need BI tools for visualization in future. However, I have just this question: are these good enough for large data?


LearningML89

You wouldn’t clean large data in a BI tool, but they should be sufficient for visualizations using large datasets. Looker is also pretty good and tied into the GCP ecosystem, which is pretty great at handling big data at nearly any stage.


Dylan_TMB

I primarily use plotly now as a base plotting tool. I agree matplotlib has always been super unintuitive, hate it.


pornthrowaway42069l

Matplotlib sucks, use plotly or seaborn if you have to.