From: sscnekro on 30 May 2010 14:22 Hi guys, do you pls know a way to improve the axis appearance in the event tick mark labels overlap? I set the limits to axis by axis([xmin,xmax,ymin,ymax]) and would like to restrict the number of ticks to just two or three. The resulting graphs (subplots) should have rather large labels relative to the plot area (font size) and scarce in number. Trying out set(gca,'XTick', min : increment : max) resulted in a desired number of ticks, however, instead of displaying 2 digits after the decimal point, each mark label now ended up with 4, which looks even much worse. I am looking for a way to adjust the code so as I don't need to "correct" each graph manually. Thanks for ideas!
From: dpb on 30 May 2010 14:23 sscnekro wrote: .... > do you pls know a way to improve the axis appearance in the event tick > mark labels overlap? I set the limits to axis by > axis([xmin,xmax,ymin,ymax]) and would like to restrict the number of > ticks to just two or three. The resulting graphs (subplots) should have > rather large labels relative to the plot area (font size) and scarce in > number. > > Trying out set(gca,'XTick', min : increment : max) resulted in a desired > number of ticks, however, instead of displaying 2 digits after the > decimal point, each mark label now ended up with 4, which looks even > much worse. I am looking for a way to adjust the code so as I don't need > to "correct" each graph manually. Thanks for ideas! You can label them however you wish using the 'X|Y|ZTickLabel' property. --
From: sscnekro on 30 May 2010 14:39 Re: dpb [> You can label them however you wish using the 'X|Y|ZTickLabel' property. ] Thanks, dpb, for the reference. Yes, I was thinking about using this set(gca,'XTickLabel',{ }) together with the set(gca, 'XTick', ...) in the code, however, it is not obvious to me how to make the code to come up with well-behaved ticks. Should I do it for each graph case-to-case, that would be no problem. But I would like to create a large set of good looking graphs (subplots) just by running the code. I also checked out the possibility to round numbers, but I only found the possibility to round to nearest integer or zero, thus no control over no. of digits. More ideas? Thanks.
From: dpb on 30 May 2010 14:56 sscnekro wrote: > Re: dpb [> You can label them however you wish using the > 'X|Y|ZTickLabel' property. ] > > Thanks, dpb, for the reference. Yes, I was thinking about using this > set(gca,'XTickLabel',{ }) together with the set(gca, 'XTick', ...) in > the code, however, it is not obvious to me how to make the code to come > up with well-behaved ticks. Should I do it for each graph case-to-case, > that would be no problem. But I would like to create a large set of good > looking graphs (subplots) just by running the code. That's a problem that's been addressed quite a lot -- algorithms to select "pretty" axis ranges. I don't have a particular one at hand in Matlab code, I suspect one could look at the plot() routine m-file and get a feel for what they do in it and salt to suit. There may be code on the file exchange (I know there are several other plotting tools there; you might also see if some of them have a more pleasing view to your eye) as well. And, of course, there's always the resort of searching for code snippets online... > I also checked out the possibility to round numbers, but I only found > the possibility to round to nearest integer or zero, thus no control > over no. of digits. More ideas? Thanks. doc num2str() % note the optional argument You can also use sprintf() to write any format you choose as well... --
From: sscnekro on 30 May 2010 16:23 Re: dpb [> You can also use sprintf() to write any format you choose as well... ] For now, for my purpose suffices to use axis([xmin,xmax,ymin,ymax]) set(gca,'XTick', xmin : increment : xmax) set(gca,'XTickLabel',{sprintf('%.2f', xmin), ... }) A big thank you!
|
Pages: 1 Prev: reading a barcode in any orientation Next: higuchi matlab code |