SWDatabase
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Classes | Functions | Variables
common.plot_common Namespace Reference

Classes

class  PlotError
 

Functions

def sphere3D
 
def equator
 
def negative_color
 Compute hex code of the corresponding negative color. More...
 
def timeserie
 Plot a timeserie object. More...
 
def timeserie_axe
 Make axis for a timeserie plot. More...
 
def double_timeserie
 Plot 2 timeseries on the same plot. More...
 
def map2D
 
def fieldline3D
 
def fieldline2D
 Plot a list of fieldlines in a 2D plot. More...
 
def slice2D
 
def chole
 Plot a coronal hole element Chole. More...
 
def plot_contour
 Compute line contour from Map2D or Cube3D object and plot it. More...
 
def plot_visible_disk
 Compute visible disk from a point (on a unit sphere?). More...
 

Variables

dictionary colormaps
 

Function Documentation

def common.plot_common.chole (   sub,
  choles 
)

Plot a coronal hole element Chole.

Parameters
[in]sub,:an existant Axis or SubplotBase object
[in]choles,:list of module_chole.Chole() objects.
[out]img_chole,:list Artist object
def common.plot_common.double_timeserie (   sub,
  timeserie1,
  timeserie2,
  color1 = 'r',
  color2 = 'b',
  index1 = None,
  index2 = None,
  label1 = None,
  label2 = None,
  ylabel = None,
  linewidth = 0.1,
  marker = '.',
  markersize = 1 
)

Plot 2 timeseries on the same plot.

Parameters
[in]sub,:an existant Axis or SubplotBase object
[in]timeserie1and timeserie2: module_timeserie.Timeserie objects to be plot
[in]color1and color2: plotted colors. Default: red and blue.
[in]index1and index2: tuple index of the data to be plot (timeserie.data is a list of tuples). Default: 0 and 0.
[in]label1and label2: labels in the legend. Default: Data name and data unit.
[in]ylabel,:y-label of the plot. Default: Data names of the 2 timeserie.
[in]linewidth.Default: 0.1
[in]maker.Type of marker. Default: .
[in]markersize.Size of marker. Default: 1
[out]Artistobject

Here is the caller graph for this function:

def common.plot_common.equator (   sub,
  color 
)
Plot dashed equator line.
Input:
  * sub: an existant matplotlib.axes._subplots.Axes3DSubplot object
  * color
Output:
  * eq: matplotlib.lines.Line2D object
def common.plot_common.fieldline2D (   sub,
  fieldlines,
  color,
  label,
  proj = 'rlon' 
)

Plot a list of fieldlines in a 2D plot.

Parameters
[in]sub,:an existant matplotlib.axes._subplots.Axes3DSubplot object created with polar projection (sub = fig.add_subplot(111, projection='polar'))
[in]fieldlines,:list of fieldlines
[in]color
[in]label,:legend for the first fieldline only
[in]proj,:'rlon' for radius,longitude plot, 'rlat' for radius,latitude plot.
[out]fl,:list of matplotlib.lines.Line2D objects
def common.plot_common.fieldline3D (   sub,
  fieldlines,
  color,
  label 
)
Plot a list of fieldlines.
Input:
  * sub: an existant matplotlib.axes._subplots.Axes3DSubplot object
  * fieldlines: list of fieldlines
  * color
  * label: legend for the first fieldline only
Output:
  * fl: list of mpl_toolkits.mplot3d.art3d objects
def common.plot_common.map2D (   sub,
  plotmap_type,
  map2D_data,
  vmin,
  vmax,
  zorder 
)
Plot a map2D background image.
Input:
  * sub: an existant Axis or SubplotBase object
  * plotmap_type: sth in ['WSO','NSO','ADAPT','SDO171','SDO193','SOHO171','SOHO195']
  * map2D_data: map2D object to be plot
  * vmin,vmax: min and max plot range
  * zorder: order of apparition in plot (0 means background, >0 foreground)
Output:
  * bimg: Artist object
def common.plot_common.negative_color (   color)

Compute hex code of the corresponding negative color.

Parameters
[in]color,:string for color
[out]negative,:hex code for negative color

Here is the caller graph for this function:

def common.plot_common.plot_contour (   sub,
  mag_object,
  levels,
  labels = None,
  color = 'r',
  linestyle = 'dashed',
  r = 2.5 
)

Compute line contour from Map2D or Cube3D object and plot it.

Parameters
[in]sub: an existant Axis or SubplotBase object or None if you do not want to plot (Achtung: if None, plt will be closed!)
[in]mag_object: Map2D or Cube3D object containing radial magnetic field data
[in]levels: list of float (1..n) levels to be plot
[in]labels: list of strings (1..n) labels in legend. Default: empty string(s).
[in]color: color plot. Defaut: red.
[in]linestyle: dashed (default) or solid
[in]r: altitude in solar radius where the contour is drawn. Default: 2.5. For map2D object, not taken into account, only for the output points. For cube3D, take the slice at altitude r.
[out]points: list of nlevel list
[out]points[ilevel]: list of module_timespace.Coordinate objects. R = input r.
Todo:
In cube3D case, select cube slice at r = r.
def common.plot_common.plot_visible_disk (   sub,
  position,
  levels,
  labels = None,
  color = 'r',
  linestyle = 'solid',
  r = 1 
)

Compute visible disk from a point (on a unit sphere?).

Grid for plotting:

  • phi=[0:360]
  • the=[90:-90]
Parameters
[in]sub: an existant Axis or SubplotBase object or None if you do not want to plot (Achtung: if None, plt will be closed!)
[in]position: module_timespace.Coordinate object
[in]levels: list of float (1..n) levels to be plot
[in]labels: list of strings (1..n) labels in legend. Default: empty string(s).
[in]color: color plot. Defaut: red.
[in]linestyle: Default: solid.
[in]r: altitude in solar radius where the contour is drawn. Default: 2.5. For map2D object, not taken into account, only for the output points. For cube3D, take the slice at altitude r.
[out]points: list of nlevel list
[out]points[ilevel]: list of module_timespace.Coordinate objects. R = Rsun.
def common.plot_common.slice2D (   sub,
  cube3D_data,
  var,
  dim,
  i,
  vmin,
  vmax,
  zorder 
)
Plot a cube3D slice background image.
Input:
  * sub: an existant Axis or SubplotBase object
  * cube3D_data: cube3D object to be plot
  * var: br, bthe, bphi or b1, b2, b3
  * dim: 0 or 1 or 2. Slice dim to be plot.
  * i: index of the slice.
  * zorder: order of apparition in plot (0 means background, >0 foreground)
Output:
  * bimg: Artist object
def common.plot_common.sphere3D (   sub,
  x0,
  y0,
  z0,
  r,
  color 
)
Plot a sphere.
Input:
  * sub: an existant matplotlib.axes._subplots.Axes3DSubplot object
  * x0,y0,z0,r: center cartesian coordinate and radius
  * color
Output:
  * sphere: mpl_toolkits.mplot3d.art3d.Poly3DCollection object
def common.plot_common.timeserie (   sub,
  timeserie,
  color,
  index = 0,
  color_positive = False,
  linewidth = 0.1,
  marker = '.',
  markersize = 1 
)

Plot a timeserie object.

Parameters
[in]sub,:an existant Axis or SubplotBase object
[in]timeserie,:map2D object to be plot
[in]color
[in]index,:as timeserie data is a tuple, select only the index-element of this tuple
[in]color_positive,:boolean. False by default. If True, input color for positive value, negative input color for negative
[in]linewidth.Default: 0.1
[in]maker.Type of marker. Default: .
[in]markersize.Size of marker. Default: 1
[out]Artistobject

Here is the call graph for this function:

def common.plot_common.timeserie_axe (   sub,
  timeserie,
  index = 0 
)

Make axis for a timeserie plot.

Here is the call graph for this function:

Variable Documentation

dictionary common.plot_common.colormaps
Initial value:
1 = {
2 'ASCII_MAP2D' : 'Greys',
3 'OBS_MAPS_WSO_ORIGIN' : 'Greys_r',
4 'OBS_MAPS_WSO_FILLED' : 'Greys_r',
5 'OBS_MAPS_WSO_DATE' : 'Greys_r',
6 'OBS_MAPS_NSO' : 'Greys_r',
7 'OBS_MAPS_NSOZ' : 'Greys_r',
8 'OBS_MAPS_ADAPT40' : 'Greys_r',
9 'OBS_MAPS_ADAPT41' : 'Greys_r',
10 'OBS_MAPS_SDO_AIA_171' : 'sdoaia171',
11 'OBS_MAPS_SDO_AIA_193' : 'sdoaia193',
12 'OBS_MAPS_SDO_HMI' : 'hmimag',
13 'OBS_MAPS_SOHO_EIT_171' : 'sohoeit171',
14 'OBS_MAPS_SOHO_EIT_195' : 'sohoeit195',
15 'OBS_MAPS_EUV2CARMAP_SDOSTA_171' : 'sdoaia171',
16 'OBS_MAPS_EUV2CARMAP_SDOSTA_193' : 'sdoaia193',
17 'OBS_MAPS_EUV2CARMAP_SDOSTA_304' : 'sdoaia304',
18 'OBS_MAPS_WL2CARMAP_SOHOLASCO_C2': 'Greys_r',
19 'QSLSQUASHER' : 'Greys',
20 'OBS_MAPS_EUV2CARMAP_SDO360_171' : 'sdoaia171',
21 'OBS_MAPS_EUV2CARMAP_SDO360_193' : 'sdoaia193',
22 'OBS_MAPS_EUV2CARMAP_SDO360_304' : 'sdoaia304',
23 }