newville / wxmplot

wxPython plotting widgets using matplotlib
https://newville.github.io/wxmplot/
MIT License
76 stars 26 forks source link

can vector images be drawn on the photoplane? how so #10

Closed ganravichandran closed 12 years ago

newville commented 12 years ago

Not sure. what is a vector image? what is the photoplane?

wxmplot is wrapping matplotlib for wx...

ganravichandran commented 12 years ago

Sorry for the confusion. I am referring to geometric shapes. I specifically want to draw a circle wherever I click on the image. And my mistake, I meant photopanel, not photoplane. Also, is there any way to get the pixel coordinates while the mouse is in motion arather than only during Left Mouse Click? Thank you very much.

newville commented 12 years ago

Ganesh,

On Sat, Sep 8, 2012 at 10:43 PM, Ganesh Ravichandran notifications@github.com wrote:

Sorry for the confusion. I am referring to geometric shapes. I specifically want to draw a circle wherever I click on the image.

Uh, why would you want that in a plotting program? That's a paint program. So, no, not unless you can explain what you want much better.

Also, is there any way to get the pixel coordinates while the mouse is in motion arather than only during Left Mouse Click?

It does show up in the lower right panel of the PlotFrame. If you want it somewhere else, do so.

Thank you very much.

You didn't respond to my questions to you about your request to change the zooming behavior, and now are asking more changes to what happens with mouse interaction, and using language (you never did tell me what a photopanel is) that suggests you don't really know what your talking about.

The way this works is that you ask clear, direct questions. Or you submit changes to the code. Random requests for feature changes are not likely to be taken seriously. Especially when they are phrased in a way that suggests you haven't read the docs or code.

If you want me to do anything to help you, you will explain what you want in terms of the existing behavior, and ideally submit code. You will also answer all of my questions to you, including the ones I have already asked.

--Matt

ganravichandran commented 12 years ago

I'm very sorry, this is my first time using Github and I'm a beginner programmer, and I did not realize that I was being unclear. Please allow me to explain my question again.

I am designing a GUI (using wxPython) that will allow a user to look at images of stars and save the locations of stars by clicking on the image. The program will display a Flexible Image Transport System (FITS) image. I'm using pyfits (a FITS image module) to convert the FITS image into a Numpy array. Then I use wxmplot.ImagePanel to display the image in a wxPython Frame.

The images I will be using are pictures of stars, and when a user clicks the image (at the locaation of a star), the pixel coordinates of the clicked location should be saved as the coordinates of the star in the image. Then a circle should appear on the image around the clicked location so that the user knows that that star has been accounted for. The problem I am having is how to draw a circle on the image using the pixel coordinates of the image.

Previously, I used the term 'photoplane' when I really meant ImagePanel in my question, and I apologize for that. After looking through the source code of basepanel.py and imagepanel.py, I could not find a way to draw circles on the image using the image coordinates using wx.DC (a device context that draws circles for wxPython). I was also unsuccessful in finding a drawing method in the ImagePanel documentation.

To sum up, I am looking for a way to draw circles on an ImagePanel by clicking on the ImagePanel (since the left button click already has a purpose, I will probably use the right button click event of the mouse). To do this, I would like to know if there any way for me to access the FigureCanvasWxAgg (canvas object) in ImagePanel and use matplotlib to add circles to the image.

Please let me know if I left any details obscure.

Please advise.

Thank you for your patience, Ganesh Ravichandran

newville commented 12 years ago

Ganesh,

On Sun, Sep 9, 2012 at 3:19 PM, Ganesh Ravichandran notifications@github.com wrote:

I'm very sorry, this is my first time using Github and I'm a beginner programmer, and I did not realize that I was being unclear. Please allow me to explain my question again.

OK, this doesn't seem to be an Issue -- it's a question about capabilities. I'm closing the Issue. Please use Issues appropriately.

I am designing a GUI (using wxPython) that will allow a user to look at images of stars and save the locations of stars by clicking on the image. The program will display a Flexible Image Transport System (FITS) image. I'm using pyfits (a FITS image module) to convert the FITS image into a Numpy array. Then I use wxmplot.ImagePanel to display the image in a wxPython Frame.

The images I will be using are pictures of stars, and when a user clicks the image (at the locaation of a star), the pixel coordinates of the clicked location should be saved as the coordinates of the star in the image. Then a circle should appear on the image around the clicked location so that the user knows that that star has been accounted for. The problem I am having is how to draw a circle on the image using the pixel coordinates of the image.

Previously, I used the term 'photoplane' when I really meant ImagePanel in my question, and I apologize for that. After looking through the source code of basepanel.py and imagepanel.py, I could not find a way to draw circles on the image using the image coordinates using wx.DC (a device context that draws circles for wxPython). I was also unsuccessful in finding a drawing method in the ImagePanel documentation.

To sum up, I am looking for a way to draw circles on an ImagePanel by clicking on the ImagePanel (since the left button click already has a purpose, I will probably use the right button click event of the mouse). To do this, I would like to know if there any way for me to access the FigureCanvasWxAgg (canvas object) in ImagePanel and use matplotlib to add circles to the image.

Please let me know if I left any details obscure.

Please advise.

Thank you for your patience, Ganesh Ravichandran

Here is some free advice for things to think about for getting the features you want:

Are you sure that you want to use wxmplot and matplotlib at all? Which features of wxmplot and matplotlib do you want to use? Like, do youwant the user to be able to change color tables, etc?

That is, If you have a large array of data that you want shown as an image in a wx.Panel, you might find better performance converting this to a PIL Image (using it's Image.frombuffer()), and then converting to a bitmap to show as a wx.Image.

As for drawing an a circle at each user mouse-click, that shouldn't be hard for you to do. But it's not appropriate for the wxmplot.ImagePanel and is definitely an application-specific need. Of course, you're welcome to subclass the wxmplot.ImagePanel and change the behaviour for left-click.