3 ms·
Matplotlib is very easy to customize via “style sheets”, so you can make it match any style you want. Note that you can even turn on the “usetex” option and pro
by setopt 2y ago
Matplotlib is very easy to customize via “style sheets”, so you can make it match any style you want. Note that you can even turn on the “usetex” option and provide a preamble to compile all text/equations via TeX.
- aborsy 2y agoNo doubt it’s very customizable. But the display quality seems to me not as good as even matlab. At least with defaults, which is a bit barebones. You have to work on it . The syntax of python is also a bit verbose. Like, why do we need plt.show(), when I plot a figure obviously I want to plot it! Now I know, the point is, see matlab, gnuplot etc. Compare with the default plot of gnuplot. The limitation of latex is you can’t do much calculation with data, and memory usage. Don’t get me wrong, I still sometimes go to python for plotting. But it’s general purpose programming language, and for specific applications there are custom tools.
- setopt 2y agoDon’t get me wrong either – I personally prefer Gnuplot by quite a margin, Matplotlib is indeed too verbose. These days I use Matplotlib more mainly because I use Python more. I’m just saying that it doesn’t take too much configuration to make publication-quality plots in Matplotlib either, by e.g. enabling the TeX integration and setting up a reusable stylesheet file. The style sheet format is actually very reasonable, and several examples ship with Matplotlib. There’s also the Seaborn package if you want some nicer default stylesheets. (Side note, the same goes for Gnuplot… As shown by e.g. gnuplotting.org you can definitely create publication-quality plots there as well.)
- davrosthedalek 2y agognuplot + tikz terminal. I have yet to see better looking figures. And technically, it's one of the rare if not the only one solution that can give you bibtex resolved citations in figure labels.... (Don't do it, the journals hate it)
- Keysh 2y ago> The syntax of python is also a bit verbose. Like, why do we need plt.show(), when I plot a figure obviously I want to plot it! That is kind of annoying. Fortunately, it's easy to turn that off by activating "interactive mode", in which figures automatically appear when you use a plotting command. You can do this via "plt.ion()", or have it set automatically with interactive : True in your .matplotlibrc file.
- setopt 2y agoJust keep in mind that when you do this, most plots will by default reuse the existing frame without clearing it. So you need to manually call plt.figure() more often (which in my opinion is more logical than plt.show). There’s also a change in semantics regarding whether the script “hangs” until the user closes the plot window, if I recall correctly.
- Keysh 2y agoOr you can call plt.clf() to clear the frame.
- analog31 2y agoI often use Matplotlib within a GUI. It's convenient to be able to defer the display of a plot until it's fully built, for instance if the plot is displaying data in a live update mode.
- KeplerBoy 2y agoThat's the whole point. It's not at all obvious that you want to show the plot. It's just as valid to save the plot and use the file in an external document.