scientimate.plot3d#
scientimate.plot3d(x, y, z, plottype='imagesc', cmapcolors='blue')
Description#
Plot x , y, and z data in 2-d/3-d contour/surface plot
Inputs#
- x
- x dataSet x=[] if it is not availableIt may be 1d or 2d array
- y
- y dataSet y=[] if it is not availableIt may be 1d or 2d array
- z
- z dataIt may be 1d or 2d array
- plottype=’imagesc’
- Plot type‘imagesc’: 2 dimensional plot using imagesc or imshow‘pcolor’: 2 dimensional plot using pcolor‘contour’: 2 dimensional contour plot, number of contour=32‘contourf’: 2 dimensional filled contour plot, number of contour=32‘surface’: 3 dimensional surface plot
- cmapcolors=’blue’
- Colormap style‘blue’: blue colormap‘red’: red colormap‘green’: green colormap‘yellow’: yellow colormap‘purple’: purple colormap‘brown’: brown colormap‘gray’: gray colormap‘blue_red’: blue-red colormap‘red_blue’: red-blue colormap‘blue_green’: blue-green colormap‘green_blue’: green-blue colormap‘green_yellow’: green-yellow colormap‘yellow_green’: yellow-green colormap‘red_yellow’: red-yellow colormap‘yellow_red’: yellow-red colormap‘cyclic’: cyclic/oscillation colormap‘seq’: sequential colormapUser-defined colors may be used to generate colormapUser-defined colors should be defined as (M,3) array in RGB color formatAt least two colors should be defined, i.e. M should be equal or larger than 2User-defined colors values should be between 0 and 255Any available colormap name such as ‘cool’, ‘winter’, etc also can be used
Outputs#
Examples#
import scientimate as sm
import numpy as np
x,y=np.meshgrid(np.linspace(-10,10,50),np.linspace(-10,10,50))
r=np.sqrt(x**2+y**2)+1e-10 #Add 1e-10 to prevent divide by 0
z=np.sin(r)/r
sm.plot3d(x,y,z,'surface','purple')
x,y=np.meshgrid(np.linspace(-10,10,21),np.linspace(-10,10,21))
z=(np.sin(x)+np.sin(y))/(x+y+1e-10) #Add 1e-10 to prevent divide by 0
sm.plot3d(x,y,z,'pcolor','purple')
x=10*np.random.rand(1000)
y=10*np.random.rand(1000)
z=x**2+y**2
sm.plot3d(x,y,z,'pcolor','blue')
References#
Colormap
Color