Category "matplotlib"

Draw a line between points, ignoring missing data, with matplotlib

Numerous similar questions have been asked over the years, such as this one here, but none of the accepted answers solve my problem. The following code: x=[0, 0

How can I add legend while plotting multiple geopandas dataframes in the same subplot using matplotlib in Python?

I have a geopandas dataframe world which I created using: import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) I create

Draw a line between points, ignoring missing data, with matplotlib

Numerous similar questions have been asked over the years, such as this one here, but none of the accepted answers solve my problem. The following code: x=[0, 0

Plotting multiple store sales into 1 plot

I have problem plotting multiple timeseries into 1 plot. My dataframe looks like this: So I want all 10 stores plotted into 1 plot, such that all stores have

How to decrease the space between grouped bar-subplots in matplotlib?

import matplotlib import matplotlib.pyplot as plt import numpy as np a_means, a_CI = (70, 60), (2.7, 1.9) b_means, b_CI = (85, 83), (2.6, 1.2) c_means, c_CI =

How to ensure that the labels of two axes do not overlap?

I have some questions about labels of axs. Firstly,I have 2 subplots which can be seen below. As you can see, labels of first ax are overlapping with the second

matplotlib multiple line plot color according to reference value

If i have a dataset: import numpy as np import matplotlib.pyplot as plt y = np.array([np.random.randn(10) for k in range(100)]) plt.plot(y) And a correspondin

Cartopy: coastlines not lining up with imshow projection

I'm trying to produce a figure in Python that will line up the map coastlines from Cartopy with a RGB projection using satellite data (POLDER) that is fixed to

Adding a black edgecolor around to legend entries in matplotlib

I've made this pie chart in python and I would like to know how to add a black frame around each boxcolor in the legend. I mean around of each color square like

How to improve the given line of code while filtering pandas dataframe?

The below line of code was to filter a dataframe. I would like to know how to improve this line of code T1_df = df2[((df2['Azimuth'] > (df2['Sim_Az'] - 1

Seaborn not plotting head but instead plots whole dataframe

I have a dataframe that I groupby() count and then sort_values() by count. I then take the head() and tail() of this dataframe to plot on a seaborn barplot(). H

Displaying a stacked bar graph with nested lists

I am trying to display a stacked bar graph.I have 3 lists as shown below- totalpointperxaxis [6, 9, 13, 5, 14, 382, 26, 2, 45, 2] clusternamesList [['Cluster1'

How to do the visualization of Optimal Classification Trees in python

I used the code in github:https://github.com/pan5431333/pyoptree. I read the raw code and did not find how to draw the tree, please give me some useful guide to

Nested bar plots with three y axis using seaborn package

Using the python seaborn package I was trying to plot the nested bar graphs with three different y-axes as shown in the below figure: And the code that I have

I want to animate the solar system with python matplotlib

So basically I have this project at school where we decide something we want to plot. I decided to plot the solar system animated to find out when is the next t

How can I plot Gaussian pseudo-random noise for N = 2?

How would one plot the Gaussian pseudo-random noise when N = 2 from the given code below? I don't know how to incorporate N into the formula in the code. I need

How to control the color of a specific column in a bar plot depending on it's xtick label?

I have a number of plots that show transcribed text from a speech to text engine in which I want to show the bars where the S2T engine transcribed correctly. I

Highlighting specific data points for parallel coordinates plot

I'm looking for help to highlight/color particular data points on the parallel coordinates plot. I can't seem to find a way that work. Essentially, I want to pl

Matplotlib plots in the wrong data format eventhough it is a datetime object [duplicate]

I have a problem when trying to plot a timeseries with matplotlib: df = pd.read_csv('myfile.dat', skiprows=1) #Change data type to datetime d

How to shared color palette between multiple subplots?

I have the following figure: The figure is composed by the following code snippet: fig = plt.figure(constrained_layout=True) grid = fig.add_gridspec(2, 2) ax_