Color in Multiple Subplots Plotly Chart

I would like to have a multiple subplots to compare before and after workout progress. As you can see in the attached image, they are all in different colors and I would like to have the same color of before and after workout in each plot. Anyone knows how to do that? This is what… Read More Color in Multiple Subplots Plotly Chart

How to change the legend string for different subplots?

I would like to add a legend to every subplot as shown below each legend is theta_(1/2)=5, theta_(1/2)= 10, theta_(1/2)=15,…,theta_(1/2)=60. How can I change the number for each legend? Q = [16,32,64,128,256,512,1024]; VEC_Beam_5 = [113.2659 69.7204 51.8739 34.5033 21.6538 10.9459 5.9488]; % Coverage area of Theta = 5 VEC_Beam_10 = [117.5491 76.1452 53.3016 38.3105 23.0815… Read More How to change the legend string for different subplots?

How to remove all y-axis tick labels and markers except for '0' in a matplotlib subplot?

The code: import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter fig, axs = plt.subplots(2, sharex = True, figsize=(9,6),dpi=500, gridspec_kw={‘height_ratios’: [3, 1]}) axs[0].set_title("Smoothed Kalman Point Estimate Fit to " + symbol) axs[0].plot(dates, price_series, c=’black’, linestyle = ‘-‘, linewidth = 2) axs[0].plot(dates, kf_point_est, c=’yellow’, linestyle = ‘-‘, linewidth = 1) axs[0].xaxis.set_major_formatter(DateFormatter("%y")) axs[0].margins(x=0) axs[1].set_title("Slope") axs[1].plot(dates, pos_slope, color=’g’) axs[1].plot(dates,… Read More How to remove all y-axis tick labels and markers except for '0' in a matplotlib subplot?

Make a parabola steeper at both sides while keeping both ends

I’m having a parabola with both axes being from 0 to 1 as follows: The parabola is created and normalized with the following code: import matplotlib.pyplot as plt import numpy as np # normalize array def min_max_scale_array(arr): arr = np.array(arr) return (arr – arr.min())/(arr.max()-arr.min()) x = np.linspace(-50,50,100) y = x**2 x = min_max_scale_array(x) y =… Read More Make a parabola steeper at both sides while keeping both ends

Move the bottom of a curve without changing both ends

I’m having a curve as follows: The curve is generated with the following code: import matplotlib.pyplot as plt import numpy as np # normalize array def min_max_scale_array(arr): arr = np.array(arr) return (arr – arr.min())/(arr.max()-arr.min()) x = np.linspace(-50,48,100) y = x**2 + 2*x + 2 x = min_max_scale_array(x) y = min_max_scale_array(y) fig, ax = plt.subplots() ax.plot(x,… Read More Move the bottom of a curve without changing both ends

wrong time and resolution axis when plotting time series (secs instead of min)

I want to plot a DataFrame as a time series import matplotlib.pyplot as plt plt.plot(df[‘time’],df[‘Power’]) or df2 = df.set_index(‘time’) df2.Power.plot() which both show all 3531 y values correctly but wrong x axis time labels, like 25 seconds instead of 25 minutes. timestamps are not completely regular and have ms decimals 0 2022-05-16 19:59:25.690 1 2022-05-16… Read More wrong time and resolution axis when plotting time series (secs instead of min)