robbievanleeuwen / concrete-properties

Calculate section properties for reinforced concrete sections.
https://concrete-properties.rtfd.io
MIT License
146 stars 43 forks source link

Plot Stress Error #33

Closed afugur closed 2 years ago

afugur commented 2 years ago

Hello @robbievanleeuwen,

I tried to use (https://robbievanleeuwen.github.io/concrete-properties/notebooks/stress_analysis.html) example I can calculate stresses but I can't show them. I take the error in below. My codes are same with example I didn't change anything.

if self._A.ndim > 1 and not isinstance(self, QuadMesh): AttributeError: 'list' object has no attribute 'ndim'

Thanks.

github-actions[bot] commented 2 years ago

Thanks for opening your first issue in concreteproperties :raised_hands: Pull requests are always welcome :wink:

robbievanleeuwen commented 2 years ago

Hi @afugur,

Sorry for the delayed response, I've had a busy week!

It's hard to narrow this one down without any further information. What OS are you using? What version of python? Can you include a full output of the error - it should show which package is throwing the error. If it's matplotlib, what version of matplotlib? Next time it would be helpful if you could follow the bug report issue template as there is almost no context here.

I'm thinking it could be an issue with your environment packages. Have you tried installing concreteproperties into a fresh python environment with no other packages and ensuring the dependencies are up to date?

robbievanleeuwen commented 2 years ago

Hi @afugur wondering if you had any luck fixing this issue? If it's resolved I will close this issue.

afugur commented 2 years ago

Hi @robbievanleeuwen,

Sorry about my delayed message, I have had a very busy week.

I will send the informations about my python versions and other libraries tomorrow. Also sorry about my bad issue explanation.

robbievanleeuwen commented 2 years ago

All good @afugur, let me know how you go.

afugur commented 2 years ago

Hi @robbievanleeuwen,

I took to code from concreteproperties in 7. Stress Analysis section. It is a code:

`import numpy as np from rich.pretty import pprint from concreteproperties.material import Concrete, SteelBar from concreteproperties.stress_strain_profile import ( EurocodeNonLinear, RectangularStressBlock, SteelElasticPlastic, ) from sectionproperties.pre.library.concrete_sections import concrete_circular_section from concreteproperties.concrete_section import ConcreteSection

concrete = Concrete( name="40 MPa Concrete", density=2.4e-6, stress_strain_profile=EurocodeNonLinear( elastic_modulus=32.8e3, ultimate_strain=0.0035, compressive_strength=40, compressive_strain=0.0023, tensile_strength=3.8, tension_softening_stiffness=10e3, ), ultimate_stress_strain_profile=RectangularStressBlock( compressive_strength=40, alpha=0.79, gamma=0.87, ultimate_strain=0.003, ), alpha_squash=0.85, flexural_tensile_strength=3.8, colour="lightgrey", )

steel = SteelBar( name="500 MPa Steel", density=7.85e-6, stress_strain_profile=SteelElasticPlastic( yield_strength=500, elastic_modulus=200e3, fracture_strain=0.05, ), colour="grey", )

geom = concrete_circular_section( d=600, n=32, dia=20, n_bar=10, n_circle=4, area_conc=np.pi 600 600 / 4, area_bar=310, cover=45, conc_mat=concrete, steel_mat=steel, )

conc_sec = ConcreteSection(geom) conc_sec.plot_section()

uncr_stress_res_1 = conc_sec.calculate_uncracked_stress(m_x=50e6) uncr_stress_res_2 = conc_sec.calculate_uncracked_stress(m_x=25e6, m_y=35e6, n=200e3)

uncr_stress_res_1.plot_stress()`

If I run the uncr_stress_res_1.plot_stress() This error is appeared ;

` File " Anaconda3\lib\site-packages\IPython\core\formatters.py", line 341, in call return printer(obj)

File " Anaconda3\lib\site-packages\IPython\core\pylabtools.py", line 151, in print_figure fig.canvas.print_figure(bytes_io, **kw)

File " Anaconda3\lib\site-packages\matplotlib\backend_bases.py", line 2230, in print_figure self.figure.draw(renderer)

File " Anaconda3\lib\site-packages\matplotlib\artist.py", line 74, in draw_wrapper result = draw(artist, renderer, *args, **kwargs)

File "Anaconda3\lib\site-packages\matplotlib\artist.py", line 51, in draw_wrapper return draw(artist, renderer, *args, **kwargs)

File " Anaconda3\lib\site-packages\matplotlib\figure.py", line 2790, in draw mimage._draw_list_compositing_images(

File " Anaconda3\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images a.draw(renderer)

File " Anaconda3\lib\site-packages\matplotlib\artist.py", line 51, in draw_wrapper return draw(artist, renderer, *args, **kwargs)

File " Anaconda3\lib\site-packages\matplotlib_api\deprecation.py", line 431, in wrapper return func(*inner_args, **inner_kwargs)

File " Anaconda3\lib\site-packages\matplotlib\axes_base.py", line 2921, in draw mimage._draw_list_compositing_images(renderer, self, artists)

File " Anaconda3\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images a.draw(renderer)

File " Anaconda3\lib\site-packages\matplotlib\artist.py", line 51, in draw_wrapper return draw(artist, renderer, *args, **kwargs)

File " Anaconda3\lib\site-packages\matplotlib\collections.py", line 350, in draw self.update_scalarmappable()

File " Anaconda3\lib\site-packages\matplotlib\collections.py", line 912, in update_scalarmappable if self._A.ndim > 1 and not isinstance(self, QuadMesh):

AttributeError: 'list' object has no attribute 'ndim' `

---Versions

OS : Win10 Python: 3.9.7 Matplotlib : 3.4.3 numpy : 1.20.3 concreteproperties : 0.30 sectionproperties : 2.1.2 Shapely : 1.8.2

Thank you for your time.

robbievanleeuwen commented 2 years ago

Hi @afgur, are you trying to execute this code in Jupyter notebook? I would recommend trying to execute it in a terminal to see if it works there?

Otherwise I would try to create a fresh environment and only install concreteproperties in it and try that.

There shouldn't be an issue creating these plots as they have been tested in multiple environments on multiple operating systems.

Lastly you could try upgrading matplotlib to v3.5?

afugur commented 2 years ago

Hi again @robbievanleeuwen the problem is about matplotlib version. I upgraded matplotlib from 3.4.3 to 3.5.0. Thank you so much.