Combining two .T.plots into one graph - python

So looking around i've seen a few posts about combining graphs online,but none seem to apply to the graphs im using. while i'm happy to use matplotlib I can't seem to get my code to work in that while it does work in panda.
df = pd.read_excel (r'FILE-Location', index_col='PT: TD: BP')
df.iloc[1:2].T.plot()
df.iloc[2:3].T.plot()
These are the two seperate plots I wish to plot onto the same graph. I know it's a weird request and I could very easily combine them by making it [1:3] however I wish to keep them seperate as I plan to have them as options on tkinter, in which you can check a box of which lines you would like displayed, in order to do this I have to keep them seperate.
Thanks for any help solving this.
Edit: thanks for linking a similiar post, I tested the methods given there and they all seemed to simply plot into four seperate graphs within the same figure, while im looking for all four overlayed onto the same graph.

Related

Python: Plotly, how to replicate R's mixed corrlots

I saw a blog post somewhere with plots like these which seem quite popular in the R ecosystem. I've encountered something similar with the package nxviz. How can this kind of graph be replicated in Python's plotly and matplotlib? I'm interested in a somewhat general solution as I've seen lots of things being put inside the grid's boxes. (Note I do know about subplots and scatter matrices by I can't find an option to have lines, nor do I know how to fill the resulting boxes with color-coded circles, text etc, only plots).

python heatmap with uneven box sizes

I'm trying to create a heatmap for stock returns like the one used in https://finviz.com/map.ashx, which looks like:
Does anyone know how to create something like this in python? The closest I've found is "Heatmap with Unequal Block Sizes" for plotly, https://plotly.com/python/heatmaps/. I could probably make that work by subdividing everything into dozens of smaller heatmaps and then gluing them together in Dash, but is there a better way? Does anyone know of a tool that makes this type of graph, or would I have to make it from scratch?

How to programmatically delete a specific plot in mayavi

I made a bunch of plots using stuff like
plot_to_delete_later = mlab.points3d(...)
I want to remove this later on, but keep the other plots. I can do this in the GUI (see image), but can't seem to find the trick to doing it in code.
Any help much appreciated.

matplotlib plot line with color controlled by a third variable, ask for better solution

I know there are several questions about this in stackoverflow, but the current solution still has some problems.
I am following the solution provided by http://nbviewer.ipython.org/github/dpsanders/matplotlib-examples/blob/master/colorline.ipynb using LineCollection.
Actually it works. But when I save the figure into PDF file. After zooming in, it looks not very good. The size of PDF file is hundreds of times of simply plot without changing color. I understand why it looks like this. Is there any idea to plot the color-line smoother?

Create a figure of figures with matplotlib

I would like to know if there is a way to combined several figures created with matplotlib in one unique figure.
Most of the existing topics are related to multiple plots within one figure. But here, I have several functions which all create one elaborated figure (not just a plot, the figure itself is a multiple plot with texts, title, legends,...)
So instead of just doing the layout of those several figures using a software like Word, is there a way to directly combined all my figures in one unique figure under python ?
Thank you in advance !
The concept of figure in matplotlib does not allow to have a figure inside a figure. The figure is the canvas for other artists, like axes. You may of course add as many axes to a figure as you like. So for example instead of one figure with 4 axes and another figure with 6 axes, you can create a figure with 10 axes.
A good choice may be to use the gridspec, as detailed on the respecive matplotlib page.
After additional researches, it seems my problem has no easy solution within Matplotlib itself. Multiple figures layout needs external post-processing of plots.
For those having the same problem, here is an interesting link :
Publication-quality figures with matplotlib and svgutils

Categories

Resources