plot

How can I create a plot to visualize the 68–95–99.7 rule?

How can I create a plot to visualize the 68–95–99.7 rule? Question: I’ve created a plot of normal distribution like this: fig, ax = plt.subplots() ax.set_title(‘Плотнось распределения вероятности’) ax.set_xlabel(‘x’) ax.set_ylabel(‘f(x)’) x = np.linspace(148, 200, 100) # X от 148 до 200 y = (1 / (5 * math.sqrt(2*math.pi))) * np.exp((-(x-178)**2) / (2*5**2)) ax.plot(x, y) plt.show() …

Total answers: 1

How to plot a matrix with description for each column and row?

How to plot a matrix with description for each column and row Question: I have a data set I need to augment. Therefore, I have implemented an augmentation method called magnitude warping that has two hyperparameters to tune, namely sigma and knots. To assess the quality, I have two models that I train using the …

Total answers: 1

Reducing the number of x-axis ticks on Matplotlib plot from Panda

Reducing the number of x-axis ticks on Matplotlib plot from Panda Question: I need to reduce or manually set the number of ticks on the x-axis of a Matplotlib line plot. This question has been asked many times here, I’ve gone through as many of those answers as I can find and through the Matplotlib …

Total answers: 2

Plotting surface and curve in 3D and a curve in xy-plane, all in the same plot

Plotting surface and curve in 3D and a curve in xy-plane, all in the same plot Question: To illustrate an optimization problem, I want all of this in the same 3D plot: A surface. A curve in the xy-plane. A curve/path on the surface which marks out the points on the surface that lies directly …

Total answers: 1

Plotting pcolormesh in python from csv data

Plotting pcolormesh in python from csv data Question: I am trying to make a pcolormesh plot in python from my csv file. But I am stuck with dimension error. My csv looks like this: ratio 5% 10% 20% 30% 40% 50% 1.2 0.60 0.63 0.62 0.66 0.66 0.77 1.5 0.71 0.81 0.75 0.78 0.76 0.77 …

Total answers: 1

Python : Pandas Chaining : How to add text to the plot?

Python : Pandas Chaining : How to add text to the plot? Question: How to add text/label to a bar plot, when using pandas chaining ? Below is how I’m plotting without the label. ( df .groupby([‘col1′,’col2’], dropna=False) [[‘col1’, ‘col2′]] .size() .unstack() .plot(kind=’bar’, figsize = (8,8)) ) The unstacked data frame (right before .plot in …

Total answers: 1

python: label position lineplot() with secondary y-axes

python: label position lineplot() with secondary y-axes Question: I have a produce a plot with secondary y-axes and the labels are on top of each other: The code is the following: sns.lineplot(data=incident_cnt["A"], ax=ax,color="#FF4613", marker=’o’) sns.lineplot(data=incident_cnt["B"], ax=ax, color="#80D5FF", marker=’o’) ax2 = ax.twinx() sns.lineplot(data=incident_cnt["C"], ax=ax2, color="#00FFAA", marker=’o’) ax.set_xlabel("Date of index event") ax.set_ylabel("Patients (no)") ax2.set_ylabel("Patients (no) – DIC", …

Total answers: 1

python: secondary axes 10 times smaller that the main axes using twinx()

secondary axes 10 times smaller that the main axes using twinx() Question: I am producing a plot and I want to make the secondary y-axes 10 times smaller than the main y-axes. ax2 = ax.twinx() sns.lineplot(data=df["A"], ax=ax) sns.lineplot(data=df["B"], ax=ax2) is it possible to do define ax2 = ax.twinx()/10? how can specifcy that ax2 should be …

Total answers: 1

Setting an array element with a sequence.The requested array has an inhomogeneous shape after1dimensions.The detected shapewas(18,)+inhomogeneouspart

Setting an array element with a sequence.The requested array has an inhomogeneous shape after1dimensions.The detected shapewas(18,)+inhomogeneouspart Question: I’m trying to do a scatterplot between this 2 variables, but it gives me this error. ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was …

Total answers: 1

plotting a grouped bar chart with bins

plotting a grouped bar chart with bins Question: I have a dataframe similar to like this: Create Date count1 count2 count3 count4 2018-01 12 21 12 123 2018-02 11 25 12 145 2018-08 12 26 12 145 2019-03 13 28 12 334 2019-06 15 22 12 345 2019-07 16 25 12 165 2020-01 12 25 …

Total answers: 1