0

Consider The following code:

   import matplotlib.pyplot as plt
   x = [[512],[256],[1024],[2048],[4096],[8192],[32768],
       [65536],[131072]]
   y =[[900,1800],[ 600, 900, 1800, 2700,3600],
      [1800],[900,1800,3600,6000,7200,10800,12000,14400,28800],
      [900, 1800, 3600, 5400, 6000, 7200, 36000],
      [600, 900, 1200, 1800, 2700, 3600, 5400, 6000, 7200, 9600, 18000, 36000],
      [1800, 2700, 3600, 4800, 5400, 6000, 7200, 10800, 18000],
      [1800, 2700, 3600, 5400, 7200, 10800, 21600],[900, 1800, 3600, 7200]]

   fig = plt.figure()

   graph = fig.add_subplot(111)
   for i in range(len(x)):
     plt.plot(x[i], y[i], color='blue', lw=1, marker='s')
   plt.title('userid_22')
   plt.xlabel('Processors')
   plt.ylabel('Est_runtime')

   plt.savefig('processor-esttimeanalysis4.png')
   plt.show()

I get the following error:

    ValueError: x and y must have same first dimension

If any one could suggest how to plot it correctly it will be helpful?

1 Answer 1

1

You didn't say exactly what you really wanted it to do, but perhaps you intended

   import matplotlib.pyplot as plt
   x = [[512],[256],[1024],[2048],[4096],[8192],[32768],
       [65536],[131072]]
   y =[[900,1800],[ 600, 900, 1800, 2700,3600],
      [1800],[900,1800,3600,6000,7200,10800,12000,14400,28800],
      [900, 1800, 3600, 5400, 6000, 7200, 36000],
      [600, 900, 1200, 1800, 2700, 3600, 5400, 6000, 7200, 9600, 18000, 36000],
      [1800, 2700, 3600, 4800, 5400, 6000, 7200, 10800, 18000],
      [1800, 2700, 3600, 5400, 7200, 10800, 21600],[900, 1800, 3600, 7200]]

   fig = plt.figure()

   graph = fig.add_subplot(111)
   for x_value, y_value in zip(x, y):
       plt.plot(x_value * len(y_value), y_value, color='blue', lw=1, marker='s')
   plt.title('userid_22')
   plt.xlabel('Processors')
   plt.ylabel('Est_runtime')

   plt.savefig('processor-esttimeanalysis4.png')
   plt.show()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.