How to convert Matlab scatterplot axis to display pixels

1 Ansicht (letzte 30 Tage)
Waleed Khalid
Waleed Khalid am 10 Feb. 2017
Kommentiert: Waleed Khalid am 3 Apr. 2017
I am drawing a circle via scatterplot and it plots it in the form of arbitrary units. I want those units to be in pixels so I can run some further algos on them. Imdistline doesn't do much as it only displays the distance in terms of the arbitrary units.

Akzeptierte Antwort

Adam
Adam am 10 Feb. 2017
Set the XLim and YLim properties of your axes to match the 'Position' property of your axes (doing the obvious maths to go from the start, size represented by position to the start, end needed by xlim and ylim), either relative to the figure (i.e. taken directly from 'Position' with the origin the same) or relative to the axes start (i.e. origin at 0 and x and y lim just set to the size of the axes).
Then draw your circle and it will be in pixel space.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 10 Feb. 2017
Bearbeitet: Walter Roberson am 12 Feb. 2017
You can set the axes Units property to Pixels and set an appropriate Position after that.
This will not affect algorithms though. It would perhaps make it slightly easier to use the figure CurrentPoint property, but normally you would use the axes CurrentPoint property anyhow.
  3 Kommentare
Walter Roberson
Walter Roberson am 27 Feb. 2017
It is not clear which coordinates you want. Axes position coordinates are always relative to the figure, but perhaps you are wanting to make them relative to the screen.
Waleed Khalid
Waleed Khalid am 3 Apr. 2017
Hi, Sorry for the late reply but yes that is exactly I want so if I export the saved image to a different program, say photoshop, I know the exact coordinates of the plotted points

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by