I wonder how in Python I can create a line graph that shows the maximum, minimum and the average for a given epoch. I don’t know much about this language and how to make one x have 3 y values. I would like to create something like: I tried to do it this way the first column is the epoch,

# Tag: matplotlib

## __init__() missing 1 error while Adding a Discrete Colorbar to a ContourPlot

I was trying to replicate the Contour Plot: for a new set of interpolated data found on interpolated.nc I got the error: Nevetheless, I realized that the error was related to the plt.colorbar(ax=ax, shrink=.98) line, so I was wondering if I could get any help in order to solve this issue, since I need the colourbar in order to do

## 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

## Matplotlib lock ylim so it can’t be adjusted while panning in UI

I have subplots whose ylims I want to keep locked, so I can scroll through them using matplotlib’s UI. I just want to pan through in the x direction, but sometimes I accidentally pan up/down so that the data pans off screen. Here is an example of an oops: What can I do so this doesn’t happen? I set the

## Mark selected pixels in an image with circle

I have an image, and I have to mark pixels whose intensity value is less than threshold value with a circle. How do you do this, Scatter plot wont work as we need two input. Help in this regard is appreciated. Answer You can use the Circle patch function from matplotlib (see doc here). Here is an example inspired by

## How to calculate area of a radar chart in plotly/matplotlib?

While attempting to create a radar chart with both matplotlib and plotly, I have been trying to figure out a way to calculate the area of each dataset as represented on the chart. This would help me holistically evaluate a dataset’s effectiveness compared to the variables I have assigned by assigning a “score,” which would be equivalent to the area

## ValueError: ‘c’ argument has 1000 elements, which is inconsistent with ‘x’ and ‘y’ with size 500

I’m in my way of studing anomaly detection for speech data. My original code written with LSTM, but I’m in faced to imbalance dataset. So I’m trying to have some insights from Pyod. On trying from Pyod sampling data, I just copied and pasted their code to my colab, but I encounter error as “ValueError: ‘c’ argument has 1000 elements,

## How to find the ‘peak’ of a polynomial regression line in Matplotlib

Is it possible to find the peak (vertex?) values (x,y) of a polynomial regression line that was computed using Matplotlib? I’ve included my basic setup below (of course with fuller data sets), as well as a screenshot of the actual regression line question. would like to find x,y values along red arrows Answer You can find the maximum from the

## Change the rotation of a standalone colorbar

I have a standalone colorbar that I would like to make vertical : I’ve tried oriental = ‘vertical’ in matplotlib.colorbar but it doesnt seem to work. I find this as a result but I would like this : Thank you ! Answer Three things you need to do: change the dimension, the order in add_axes is [left, bottom, width, height]

## How to scatter plot two concentric circles with Numpy and Matplotlib

I’m trying to recreate the following plot with Numpy and Matplotlib as part of a question, but I’m struggling to get the “random aspect” of the plot: I’ve already managed to create the two circles and plot them with this code: But I don’t know how to make them get this random scattering, like in the example image. I know