How can I have smaller squares than 'grid minor' in the plot?

Hello, I have a graph with many points (phase space) and I want to separate this phase space in many smaller squares so that I can count how many of there are full of dots. If I use grid minor the squares are not small enough so I tried to find other statements and ways. Teh only thing I found was this : http://www.mathworks.com/help/symbolic/mupad_ref/gridlinewidth.html (I want a plot like example one) . I wrote plot(s0,p0,GridLineWidth=0.5*unit::mm) but it doesnt recognize 'gridlinewidth' . I tried it with many ways so i dont think that i wrote something wrong. My matlab Version is 7.10.0 R2010a. Is it possible to not work because of the version? And if yes do you know if I can use something else to do what I want ?
Thank you.

Answers (1)

Must have the Symbolic Toolbox; not sure if there's a release issue as to when the functionality was introduced; current documentation doesn't say when introduced.
You can always draw lines wherever wanted explicitly with line or set grid lines and minor grid by adjusting the {X|Y}Tick spacing. You'd have to empirically determine the proper spacing to get the number of minor ticks wanted and since the number is controlled internally may not get exactly the specific number wanted.
Also, search File Exchange to see if there's any submission there somebody may have done that solves your problem for you...(link under ML Central menu above)

9 Comments

Thank you very much. I changed Xtick in smaller and smaller intervals and its better i think. But do you know i f I can speak inside a code (function) about one of these squares ? (This plot is part of a function and I want to stop the iteration when one of these squares is full of dots (points of the plot) , for example)
If by "speak about" you mean interrogate the minor grid values or number, the answer is "no"--it's simply an 'on|off' property value (at least until HG2, not sure if TMW introduced the functionality with the new engine or not, but that's moot point with older release with which you're working).
Did you look for a submission on File Exchange where somebody else has done the work to draw the additional grid lines already? Seems like a fairly likely candidate to have been done...or, as said, you can always draw as many lines as you need specifically where you need them and have full control over spacing.
Yes, I couldnt find something similar. So this grid is only in the picture, right ? The only way to do something like that is 'imaginary' with intervals and coordinated of the 'squares' ? (Im searching for ways without using symbolic toolbox)
To be more clear I just need to 'count' the points that I plot in every 'square'
Access to the minor tick values was introduced in R2015b.
ax = axes;
grid(ax,'minor')
ax.XAxis.MinorTickValues
ax.YAxis.MinorTickValues
I have R2010a but I did it from 'properties of axis' at the 'figure'
"I did it from 'properties of axis' at the 'figure'"
I don't follow, does this mean you've solved the problem or that you manually counted in a window and still looking for programmatic solution?
No I mean that I 'draw' the lines and the smaller intervals in the plot by 'property' but I want to do it from the 'edit window' where is my function.
"...need to 'count' the points that I plot in every 'square'"
I don't follow that you actually need to plot anything; simply bin with counts at a specific resolution of interest. See
doc histc
ADDENDUM
Oh, if it's bivariate data, see
doc hist3
and mayhaps
doc scatterhist
which I've never used if you specify the optional NBins parameter just might also give you the plot you're looking for; not sure if it'll allow an arbitrarily fine discretization or not.

Sign in to comment.

Categories

Asked:

on 25 Apr 2016

Edited:

dpb
on 26 Apr 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!