Re: Coloarbar

Markus Mützel <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <trinity-b8b9dc9a-87ee-4b59-a937-96a4aad8d441-1603191518688@3c-app-gmx-bs37>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.