Contour plots (panels.plot_shell)#

panels.plot_shell.plot_shell(shell, c, invert_y=False, vec='w', deform_u=False, deform_u_sf=100.0, filename='', ax=None, figsize=(3.5, 2.0), save=True, title='', colorbar=False, cbar_nticks=2, cbar_format=None, cbar_title='', cbar_fontsize=10, colormap='jet', aspect='equal', clean=True, dpi=400, texts=[], xs=None, ys=None, gridx=300, gridy=300, num_levels=400, vecmin=None, vecmax=None, plot_offset_x=0.0, plot_offset_y=0.0, NLgeom=True)#

Contour plot for a Ritz constants vector.

The field vec is calculated with Shell.uvw(), Shell.strain() or Shell.stress(), which update shell.fields and shell.plot_mesh; afterwards the entries of shell.fields that were not None before the call are restored, the others keep the calculated values. The plot shows \(x\) along the vertical axis and \(y\) along the horizontal axis, and the horizontal axis is inverted. Log messages are printed. When save is True the figure is written to filename and closed with matplotlib.pyplot.close().

Parameters:
shellShell

The shell whose field is plotted.

carray_like

The Ritz constants that will be used to compute the field contour.

vecstr, optional

Can be one of the components:

  • Displacement: 'u', 'v', 'w', 'phix', 'phiy'

  • Strain: 'exx', 'eyy', 'gxy', 'kxx', 'kyy', 'kxy', 'gyz', 'gxz'

  • Stress: 'Nxx', 'Nyy', 'Nxy', 'Mxx', 'Myy', 'Mxy', 'Qy', 'Qx'

Default 'w'. The transverse shear components exist only for the models based on shear deformation theories.

deform_ubool, optional

If True the contour plot will look deformed. The plotted \(x\) of each point is decreased by deform_u_sf*u and the plotted \(y\) increased by deform_u_sf*v. Default False.

deform_u_sffloat, optional

The scaling factor used to deform the contour. Dimensionless. Default 100..

invert_ybool, optional

Inverts the \(y\) axis of the plot. Default False.

savebool, optional

Flag telling whether the contour should be saved to an image file. Default True, ignored when ax is given.

dpiint, optional

Resolution of the saved file in dots per inch. Default 400.

filenamestr, optional

The file name for the generated image file. If no value is given, 'test.png' is used. Default ''.

axAxesSubplot, optional

When ax is given, the contour plot will be created inside it. Default None, a new figure is created.

figsizetuple, optional

The figure size given by (width, height), in inches, used only for a new figure. Default (3.5, 2.).

titlestr, optional

If any string is given it is added as title to the contour plot. Default ''.

colorbarbool, optional

If a colorbar should be added to the contour plot. Default False.

cbar_nticksint, optional

Number of ticks added to the colorbar. Default 2.

cbar_format[ None | format string | Formatter object ], optional

See the matplotlib.pyplot.colorbar documentation. Default None.

cbar_titlestr, optional

Colorbar title. If cbar_title == '' no title is added. Default ''.

cbar_fontsizeint, optional

Fontsize of the colorbar labels. Default 10.

colormapstring, optional

Name of a matplotlib available colormap. An invalid name, or a value that is not a string, gives 'jet' with a warning. Default 'jet'.

aspectstr, optional

String that will be passed to the AxesSubplot.set_aspect() method. Default 'equal'.

cleanbool, optional

Clean axes ticks, grids, spines etc. Default True.

textslist of dict, optional

Keyword arguments of matplotlib.axes.Axes.text(), one dictionary per text, placed in axes coordinates (transform=ax.transAxes). Default [].

xsarray_like, optional

The \(x\) positions where to calculate the displacement field. Default is None and the method _default_field is used.

ysarray_like, optional

The y positions where to calculate the displacement field. Default is None and the method _default_field is used.

gridxint, optional

Number of points along the \(x\) axis where to calculate the displacement field. Default 300.

gridyint, optional

Number of points along the \(y\) where to calculate the displacement field. Default 300.

num_levelsint, optional

Number of contour levels (higher values make the contour smoother). Default 400.

vecminfloat, optional

Minimum value for the contour scale (useful to compare with other results). If not specified it will be taken from the calculated field. Default None.

vecmaxfloat, optional

Maximum value for the contour scale. If not specified it will be taken from the calculated field. Default None.

plot_offset_x, plot_offset_yfloat, optional

Offsets added to the coordinates x and y of the plotted points, lengths. Default 0..

NLgeombool, optional

Passed to Shell.stress(), used only for the stresses. Default True.

Returns:
axmatplotlib.axes.Axes

The Matplotlib object that can be used to modify the current plot if needed.

Raises:
ValueError

If vec is not one of the components above, or if ax is not a matplotlib.axes.Axes.