Posts

2d & 3d Visualization using Matplotlip (Scatter Diagram)

#%matplotlib notebook from  matplotlib  import  pyplot  as  plt from  mpl_toolkits.mplot3d  import  Axes3D x = [- 0.41 ,  0.57 ,  0.07 ,  0.00 , - 0.29 , - 0.32 ,- 0.50 ,- 0.23 , - 0.23 ] y = [ 4.12 ,  7.71 ,  2.36 ,  9.10 ,  13.35 ,  8.13 ,  7.19 ,  13.25 , 13.43 ] z = [ 2.06 ,  0.84 ,  1.56 ,  2.07 ,  2.36 ,  1.72 ,  0.66 ,  1.25 , 1.38 ] fig = plt.figure() plt.subplot( 1 , 1 , 1 ) plt.scatter(x,y) #plt.show() fig_3d = plt.figure() projection =  "3d" plt.subplot( 1 , 1 , 1 , projection  =  "3d" ) constellation3d = plt.scatter(x,y,z) plt.show()

Matplotlip Bar Syntax.

import   codecademylib from   matplotlib   import   pyplot   as   plt drinks  = [ "cappuccino" ,  "latte" ,  "chai" ,  "americano" ,  "mocha" ,  "espresso" ] sales1  =  [ 91 ,  76 ,  56 ,  66 ,  52 ,  27 ] sales2  = [ 65 ,  82 ,  36 ,  68 ,  38 ,  40 ] #Paste the x_values code here n  =  1    # This is our first dataset (out of 2) t  =  2   # Number of datasets d  =  6   # Number of sets of bars w  =  0.8   # Width of each bar store1_x  = [ t * element  +  w * n   for   element               in  range( d )] plt . bar ( store1_x , sales1 ) n  =  2    ...

Limes Sales Graph using Matplotlip

from   matplotlib   import   pyplot   as   plt months  = [ "Jan" ,  "Feb" ,  "Mar" ,  "Apr" ,  "May" ,  "Jun" ,  "Jul" ,  "Aug" ,  "Sep" ,  "Oct" ,  "Nov" ,  "Dec" ] visits_per_month  = [ 9695 ,  7909 ,  10831 ,  12942 ,  12495 ,  16794 ,  14161 ,  12762 ,  12777 ,  12439 ,  10309 ,  8724 ] # numbers of limes of different species sold each month key_limes_per_month  = [ 92.0 ,  109.0 ,  124.0 ,  70.0 ,  101.0 ,  79.0 ,  106.0 ,  101.0 ,  103.0 ,  90.0 ,  102.0 ,  106.0 ] persian_limes_per_month  = [ 67.0 ,  51.0 ,  57.0 ,  54.0 ,  83.0 ,  90.0 ,  52.0 ,  63.0 ,  51.0 ,  44.0 ,  64.0 ,  78.0 ] blood_limes_per_month  = [ 75.0 ,  75.0 ,  76.0 ,...