Skip to content
Advertisement

Tag: plot

Format y axis as percent

I have an existing plot that was created with pandas like this: The y axis is format as float and I want to change the y axis to percentages. All of the solutions I found use ax.xyz syntax and I can only place code below the line above that creates the plot (I cannot add ax=ax to the line above.)

Plotting correlation heatmaps with Seaborn FacetGrid

I am trying to create a single image with heatmaps representing the correlation of features of data points for each label separately. With seaborn I can create a heatmap for a single class like so An I get this which makes sense: But then I try to make a list of all the labels like so: And sadly I get

Plotting in a non-blocking way with Matplotlib

I am having problems trying to make matplotlib plot a function without blocking execution. I have tried using show(block=False) as some people suggest, but all I get is a frozen window. If I simply call show(), the result is plotted properly but execution is blocked until the window is closed. From other threads I’ve read, I suspect that whether show(block=False)

How do I bin and categorize numbers in Python?

I’m not sure if binning is the correct term, but I want to implement the following for a project I am working on: I have an array or maybe a dict describing boundaries and/or regions, for example: The areas are indexed from 0 to 100 (for example). I want to classify each area into a color (that is less than

pyplot combine multiple line labels in legend

I have data that results in multiple lines being plotted, I want to give these lines a single label in my legend. I think this can be better demonstrated using the example below, As you can see at Out[23] the plot resulted in 5 distinct lines. The resulting plot looks like this Is there any way that I can tell

Setting plot background colour in Seaborn

I am using Seaborn to plot some data in Pandas. I am making some very large plots (factorplots). To see them, I am using some visualisation facilities at my university. I am using a Compound screen made up of 4 by 4 monitors with small (but nonzero) bevel — the gap between the screens. This gap is black. To minimise

Matplotlib different size subplots

I need to add two subplots to a figure. One subplot needs to be about three times as wide as the second (same height). I accomplished this using GridSpec and the colspan argument but I would like to do this using figure so I can save to PDF. I can adjust the first figure using the figsize argument in the

When to use cla(), clf() or close() for clearing a plot in matplotlib?

Matplotlib offers these functions: When should I use each function and what exactly does it do? Answer They all do different things, since matplotlib uses a hierarchical order in which a figure window contains a figure which may consist of many axes. Additionally, there are functions from the pyplot interface and there are methods on the Figure class. I will

Plot smooth line with PyPlot

I’ve got the following simple script that plots a graph: As it is now, the line goes straight from point to point which looks ok, but could be better in my opinion. What I want is to smooth the line between the points. In Gnuplot I would have plotted with smooth cplines. Is there an easy way to do this

Advertisement