0

I want to create a contour plot as below, x_axis:Time, Y_axis:Nd, Z-axis:merged column data of D3-D8 column into 1 single variable named 'Matrix'

For this data:

enter image description here

My code:

    enter code here
    import numpy as np
    import matplotlib.pyplot as plt
    import pandas as pd
    load_var=pd.read_excel(r'path\stack.xlsx')
    load_var
    x=pd.DataFrame(load_var['Time'])
    y=pd.DataFrame(load_var['Nd'])
    a1=load_var.loc[0:3337,['D3']]
    a2=load_var.loc[0:3337,['D4']]
    a3=load_var.loc[0:3337,['D5']]
    a4=load_var.loc[0:3337,['D6']]
    a5=load_var.loc[0:3337,['D7']]
    a6=load_var.loc[0:3337,['D8']]
    Matrix=np.column_stack((a1,a2,a3,a4,a5,a6))
    Matrix = Matrix.astype(float)
    [X,Y] =meshgrid(x,y)
    plt.contour(X,Y,Matrix)

But getting an error,

Error Occurred: TypeError: unhashable type: 'numpy.ndarray'

James Z
  • 12,209
  • 10
  • 24
  • 44
  • Can please share the excel if possible. The possible reason can because of mismatch of shapes between x, y, z – Nithin Varghese Aug 16 '21 at 06:20
  • can you please suggest as to how share that demo excel file? – Subzero7 stack Aug 16 '21 at 06:23
  • if possible upload to google drive share the link here . – Nithin Varghese Aug 16 '21 at 06:24
  • **[Don't Post Screenshots](https://meta.stackoverflow.com/questions/303812/)**. Always provide a [mre], with **code, data, errors, current output, and expected output, as [formatted text](https://stackoverflow.com/help/formatting)**. It's likely the question will be down-voted and closed. You're discouraging assistance because no one wants to retype your data or code, and screenshots are often illegible. [edit] the question and **add text**. Please see [How to provide a reproducible copy of your DataFrame using `df.head(30).to_clipboard(sep=',')`](https://stackoverflow.com/questions/52413246). – Trenton McKinney Aug 16 '21 at 16:27
  • okay . henceforth I will make sure that no screenshot is used – Subzero7 stack Sep 02 '21 at 05:30
  • @NithinVarghese can you please share your email id instead so that I can share you the demo purpose generated data? – Subzero7 stack Sep 02 '21 at 05:34

0 Answers0