Skip to content
Advertisement

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

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

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

Advertisement