# PlotMarkers as values

Posted 9 years ago
2515 Views
|
4 Replies
|
1 Total Likes
|
 I have a table (N x M).I would like to plot some random points {i,j} with PlotMarkers being represented by the corresponding values in the table (row i, column j).Can anyone help me with this?
4 Replies
Sort By:
Posted 9 years ago
 No, no.. you got it right, and your code is very useful.I was required to plot 441 points. So I tried to see how it would work with a matrix 22 x 20. This takes some time even with your solution and it gives "A very large output..."So I was a bit concerned with this and was looking for other ways.But then, surprisingly for me at least, I did it with 441 points and it went almost instantly. I went back and ListPlotted again (with locations= Output from locations and markers= Output from markers) and it worked very fast. I cannot explain this phenomenon..  but, in the end it worked perfectly.Thanks a lot!
Posted 9 years ago
 Hi Sandu,This is pretty confusing. Do I understand that:You have a large matrix nxm in size.Each element of the matrix is itself a point {x,y}. So the dimensions are {n,m,2}You want to select a randomsu bset of these points from the matrix,You then want to plot the subset of points as with ListPlot.For each point you want its PlotMarker to be its {x,y} value, which is in fact its{x,y} location on the plot.If that is the case, you could also read the same value off the plot axes, of course not exactly.Regards,David
Posted 9 years ago
 As an inlustration for what I want:For a small table, I can do it in the following manner:Suppose I want 30 points, {i,j}i = RandomInteger[{1, N}, 30]; j = RandomInteger[{1, M}, 30]; points = Transpose[{i, j}];Let M be my table, I can plot what I want brutally:Show[ListPlot[{#}, PlotMarkers -> M[[#[[1]], #[[2]]]], PlotRange -> All] & /@ points]But, if the required sample size increases (the limit being, say, the bare readablity of the plotted numbers), I am affraid that this isn't the most rational way.
Posted 9 years ago
 This plots the value in the nxm matrix in locations corresponding to the indices. Is that what you meant? data = Table[RandomReal[{-10, 10}], {3}, {5}];  {n, m} = Dimensions[data];  locations = Flatten[Table[{{i, j}}, {i, n}, {j, m}], 1];  markers = Flatten[data];  ListPlot[locations, Frame -> True, Axes -> False, PlotMarkers -> markers, PlotRangePadding -> Scaled[.2]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments