ValueError: operands could not be broadcast together with shapes (31,2) (2,31)

I’m trying to plot 2 arrays but I’m receiving this error while passing to the function. Not really sure what is causing this error. 1 def plotModel(x, y, w): 2 plt.plot(x[:,1], y, “x”) …

How can I plot signal statistics(variance) of subintervals in the same graph with signal plot?

I calculated the variance for subintervals in my signal. The result is a vector that I would like to plot in the same graph as the signal below. How can I plot the variance for each subinterval? What …

How do you remove corresponding x values of missing y-data from lists?

import matplotlib.pyplot as plt #for graphing data import numpy as np plt.figure() x = col1 = [2011.005, 2012.6543, 2013.3456, 2014.7821, 2015.3421, 2016.7891, 2017.0173, 2018.1974] col2 = [1.4356, &…

How to plot the accuracy and and loss from this Keras CNN model?

The code below is for my CNN model and I want to plot the accuracy and loss for it, any help would be much appreciated. I want the output to be plotted using matplotlib so need any advice as Im not …

Sample points from a hyperboloid

A hyperboloid has the formula -x^2/a^2 – y^2/b^2 + z^2/c^2 = 1. How can I generate samples from this hyperboloid in Python? (Say, with a=b=c=1.) I was thinking to pick random x and y in [0,1] and then …

Shrink/adjust the colorbar inside the plot

I am trying to shrink a colorbar, which is positioned inside the plot. When I position it outside of the plot (i. e. pad=0.05), it works just fine. Here’s a MWE: import numpy as np import matplotlib….

I get a double decade when plot semi-log x-axis : how to force display each decade?

I am faced with a simple problem. When I do a semi-log plot(log on x-axis) like this : # Number of values for loop num_sigma_loop = 100 sigma_start = 2 sigma_end = -6 sigma = np.logspace(sigma_start,…

Matplotlib plot with ConnectionPaths objects layout issues

I have a script that plots point correspondences between images: import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import ConnectionPatch, Rectangle dpi = 100 …

How to plot DENDROGRAM in GUI

I am using a GUI from QtDesigner to plot Dendrogram. My code is below, but I can not plot the Dendrogram, how can I fix it? Error: ‘AxesSubplot’ object has no attribute ‘dendrogram’ def dendro(self): …

how to draw outside mplfinance plot?

from datetime import datetime, timedelta, date import pandas_datareader as pdr import mplfinance as mpf df_history = pdr.get_data_yahoo(symbols=’GOLD’, start=…