Skip to content
Advertisement

Tag: matplotlib

if and else in Convolution function

I have a problem with use if and else statement in convolution function. this code return error: use any() or all() how to can i use condition in convolve? I hope you always good luck. thanks. Answer The name function is called with a numpy array as the parameter. “Is the array less than 300?” isn’t meaningful. Are all the

Drawing using matplotlib in pysimplegui

How can i clean up previous drawing before drawing again with matplotlib in PySimpleGui? I wanted to draw a bar chart which i could be able to draw but not able to delete using the following code: Are there any functions that i can call to clean up any previous drawings? Can someone please helpme with it, i was looking

matplotlib: reduce empty space on axis

The following code (obtained from here): Gives me this: What I’m trying to do is reduce the empty space on the y-axis, indicated here by the red bars: How can I do this? Changing the height of the figure doesn’t seem to help. Answer One quick solution is to manually set the margins using

How to increase the size of only one plot in subplots?

If you have two subplots, how do you change the length of only the second plot? Adding figsize=(7,5) to plt.subplots changes the size of both plots, but hoping to change only the size of the 2nd one. source code: https://www.w3schools.com/python/matplotlib_subplot.asp There are no errors, but how do you adjust the size of only the 2nd plot but keeping the placement

Matching plot line colour with the name of the division

I have been trying to plot mean of ‘Sales’ for 7 divisions (blue, green, grey, orange, purple, red, yellow) for each response month. Here is a code snippet: graph image How can I ensure that colour of plot line for each division matches the name of the division i.e. ‘blue’ colour plotline for blue division, ‘yellow’ colour plotline for yellow

Plotting multiple dataframes in one chart

In the following code, in each iteration a dataframe is read from a dictionary and is plotted. My intention is see all plots in one chart, but I see multiple charts in separate windows. I see some tutorials about that, e.g. here, but it seems that they work when I want to call df.plot() with different columns. Here in my

Difference between ‘data’ and ‘axes fraction’ in matplotlib?

What does xycoords=(‘data’,’axes fraction’) mean? I have read https://matplotlib.org/stable/tutorials/text/annotations.html and it says that ‘data’ uses the axes data coordinate system, what does this mean? According to https://matplotlib.org/stable/tutorials/advanced/transforms_tutorial.html ‘data’ is the coordinate system of the data in the Axes; (0, 0) is bottom left of the axes, and (1, 1) is top right of the axes. https://matplotlib.org/stable/tutorials/text/annotations.html says ‘axes fraction’ is

Compare two dataframe columns on a histogram

I have a dataframe that looks similar to: I am required to give a visual comparison of true and estimated distances. My actual df shape is: How do I show true_distance side-by-side estimated_distance on a plot, where one can easily see the difference in each row, considering the side of my df_actual? Answer Here are some ways to do it.

Advertisement