sewkokot / opsvis

OpenSeesPy postprocessing and plotting module
GNU General Public License v3.0
35 stars 21 forks source link

Request: improving plot_model function #11

Closed mbbatukan closed 2 years ago

mbbatukan commented 2 years ago

Hi there,

Thanks for the recent update. I was wondering if you could include a couple of options in plot_model function.

  1. An option to remove all the nodes or elements from 2D or 3D plot (not node or element labels) to see just nodes or elements in the model.
  2. An option for a section cut (2D elevation view - e.g. X=0m, Y=all, Z=all) in 3D model.
sewkokot commented 2 years ago

Hi @batukan009 Thanks for the feature requests. I have implemented the first point, by adding two new arguments: nodes_only and fmt_model. The defaults are: nodes_only=False, fmt_model='b.-'. Usage examples:

opsv.plot_model(nodes_only=True)  # to show nodes only even thought the elements are defined
opsv.plot_model(fmt_model='b-')   # to show elements without node markers

For the second point I need more time.

Update and test please!

mbbatukan commented 2 years ago

Thanks @sewkokot. These options work well. Looking forward to testing other implementations.

EDIT: Just an idea, I prefer to pass a dictionary to kwargs in plot function. In this way, users can change a variety of settings to see elements or nodes only without having a secondary option.

elements only -> dict_fmt = {'color': 'blue', 'linestyle':'solid', 'linewidth': 1.0, 'marker': '', 'markersize':1.0}
nodes only -> dict_fmt = {'color': 'blue', 'linestyle':'solid', 'linewidth': 0.0, 'marker': '.', 'markersize':1.0}

plot_model(......, fmt_model=dict_fmt)
sewkokot commented 2 years ago

@mbbatukan Thank you for the dictionary suggestion. In the refactored latest opsvis package this feature is implemented and replaces the old string line formatting. See the updated examples and function documentation. Also please test!