Skip to content
Advertisement

Tag: matplotlib

matplotlib: draw a box on axes

I want to draw the box between y=75 and 90 (green and red lines on the chart), but nothing is shown up when I do ax.add_patch this is the image I get: So How do I fill out the area between red and green horizontal lines? Answer If you have a fixed area you want to fill and you want

Sort bar chart by list values in matplotlib

I am encountering an issue regarding the sorting my features by their value. I would like to see my image with bars getting shorter based on how high they are on the y-axis. Unfortunately, my barplot looks like this, with the features being sorted alphabetically: Right now I am running the following code: Here is the data going through there:

Plotting Pandas DataFrame from pivot

I am trying to plot a line graph comparing the Murder Rates of particular States through the years 1960-1962 using Pandas in a Jupyter Notebook. A little context about where I am now, and how I arrived here: I’m using a crime csv file, which looks like this: I’m only interested in 3 columns for the time being: State, Year,

bold text in matplotlib table

How to insert bold text in a cell of matplotlib table (pyplot table) ? Answer See the documentation for an example of how to iterate over the cells of the table and apply font properties. For example, to make the text in the first row bold, you could do the following:

How to remove edge lines from tripcolor plot with alpha != 0?

The matplotlib.pyplot.tripcolor example produces this image: If I change the plotting line from to then coloured edges appear: Adding antialiased=True makes things a bit better, but edges are still visible: Nothing else I tried changed the appearance of the edges. They seem unaffected by setting linewidths or edgecolors, nor by the methods set_linewidth or set_edgewidths on the tpc object. How

Advertisement