Coloarbar

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Coloarbar

Mishal0488
Hi Guys

Is there anyway the set bounds for the "colorbar" function?

Have a look at the attached plot, the yellow region and blue (maybe purple)
regions don't have numerical values to them. Can these be added in?

My code is below

figure(5)
hold on
title('Resultant Stress Due to Moments');
contourf(X,Y,Combined_Mx_My,50,'LineStyle','none')
colorbar
#contour(X,Y,Resultant_shear)
fill(Mx1,My1,'w','linestyle','none')
fill(Mx2,My2,'w','linestyle','none')
fill(Mx3,My3,'w','linestyle','none')
fill(Mx4,My4,'w','linestyle','none')
fill(Mx5,My5,'w','linestyle','none')
hold off <https://octave.1599824.n4.nabble.com/file/t373111/Untitled.jpg>



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Coloarbar

mmuetzel
Am 20. Oktober 2020 um 12:18 Uhr schrieb "Mishal0488":

> Hi Guys
>
> Is there anyway the set bounds for the "colorbar" function?
>
> Have a look at the attached plot, the yellow region and blue (maybe purple)
> regions don't have numerical values to them. Can these be added in?
>
> My code is below
>
> figure(5)
> hold on
> title('Resultant Stress Due to Moments');
> contourf(X,Y,Combined_Mx_My,50,'LineStyle','none')
> colorbar
> #contour(X,Y,Resultant_shear)
> fill(Mx1,My1,'w','linestyle','none')
> fill(Mx2,My2,'w','linestyle','none')
> fill(Mx3,My3,'w','linestyle','none')
> fill(Mx4,My4,'w','linestyle','none')
> fill(Mx5,My5,'w','linestyle','none')
> hold off <https://octave.1599824.n4.nabble.com/file/t373111/Untitled.jpg>
>

Your example code is incomplete and doesn't run for me.

See this part of the documentation of colorbar (doc colorbar):
> Implementation Note: A colorbar is created as an additional axes object with the "tag" property set to "colorbar". The created object has the extra property "location" which controls the positioning of the colorbar.

So you could change the axes ticks like so:
hcb = colorbar();
set(hcb, "ytick", -250:50:250);  # <- set here where you want to show ticks on the colorbar

HTH,
Markus



Reply | Threaded
Open this post in threaded view
|

Re: Coloarbar

Mishal0488
Hi Markus

Thanks for you help, I got it working.

Sorry the code I presented was just the plotting aspect.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html