I am using a mixture of Pandas and StatsModels to plot a time series decomposition. I followed this answer but when I call plot() it seems to be plotting a duplicate. My DataFrame looks like My index looks like but when I plot the decomposition I get this Strangely, if I plot only an element of the decomposition, the duplication
Tag: matplotlib
Save Matplotlib figure as TIFF
Does anyone know how to save a Matplotlib figure as *.tiff? It seems that this format is not supported in Python, while the journals are quite often ask for that format. I am adding some minimal code: This works: But this does not: Answer This is great! Thanks ot Martin Evans. However, for those who would like to make it
Matplotlib can’t find font installed in my Linux machine
I am trying to draw an xkcd-style plot with matplotlib (ver. 1.4.2) under Python 3. When I try to run: It opens an empty window without any image and I get the error: I have Humor Sans installed. I checked it with fc-list | grep Humor. It can also be used within other programs, like Libre Office. I also have
Seaborn pairplot legend – how to control position
I would like to move the Seaborn pairplot legend outside the scatter plot matrix. The official docs don’t give a keyword legend. I am trying to plot the legend outside the plot in 3 different locations simultaneously: bottom center, top center, right center I have tried this: The output of the above code is this file: . All 3 legends
Get data points from Seaborn distplot
I use to plot a univariate distribution of observations. Still, I need not only the chart, but also the data points. How do I get the data points from matplotlib Axes (returned by distplot)? Answer You can use the matplotlib.patches API. For instance, to get the first line: This returns two numpy arrays containing the x and y values for
Hide tick label values but keep axis labels
I have this image: I want to hide the numbers; if I use: …I get this image: It also hide the labels, V and t. How can I keep the labels while hiding the values? Answer If you use the matplotlib object-oriented approach, this is a simple task using ax.set_xticklabels() and ax.set_yticklabels(). Here we can just set them to an
How To Plot Multiple Histograms On Same Plot With Seaborn
With matplotlib, I can make a histogram with two datasets on one plot (one next to the other, not overlay). This yields the following plot. However, when I try to do this with seabron; I get the following error: So then I try to add some color values: And I get the same error. I saw this post on how
Matplotlib plots aren’t shown when running file from bash terminal
Plots are normally shown when I run files from the ipython shell or from an ipython notebook, but they don’t show up when I run the file from a bash terminal — everything else works fine when is run from a bash terminal. Sample python script (trial.py): This is what I get (plot doesn’t show up): If I do before
Dealing with masked coordinate arrays in pcolormesh
I’m working on visualizing some climate model output. The computation is done on a projected latitude/longitude grid. Since the model is simulating sea ice, all land grid cells are masked. The standard tools for plotting geographical information in Python are Basemap and Cartopy, both of which use matplotlib routines. In particular, pcolormesh is the obvious choice for plotting. If there
Contourf on the faces of a Matplotlib cube
I am trying to ‘paint’ the faces of a cube with a contourf function using Python Matplotlib. Is this possible? This is similar idea to what was done here but obviously I cannot use patches. Similarly, I don’t think I can use add_collection3d like this as it only supports PolyCollection, LineColleciton and PatchCollection. I have been trying to use contourf