On Mon, Feb 2, 2009 at 6:28 PM, Vadim Zeitlin <vz-plp...@zeitlins.org> wrote:
>  The first of these things is the display of so-called candlestick graphs:
>
>        http://en.wikipedia.org/wiki/Candlestick_chart
>
> This genuinely doesn't seem to be supported as it was requested before:
>
> http://www.mail-archive.com/plplot-devel@lists.sourceforge.net/msg00650.html
> http://www.mail-archive.com/plplot-devel@lists.sourceforge.net/msg00699.html
>
> but nothing seems to have happened since then. So the question here is
> mostly how realistic would it be for someone knowing nothing about plplot
> internals to implement support for this new graph kind, either inside or
> outside of plplot itself and if the project maintainers would be interested
> in adding support for candlestick plots to plplot itself (which will give
> me the excuse for asking many more questions) and, generally speaking, if
> anybody has any advice about implementing this.

I think this should be relatively straightforward to produce.  PLplot
provides enough low-level plotting functions that it should be fairly
straightforward to implement.  For a start, you could look at this
submitted boxplot example:

http://sourceforge.net/tracker/index.php?func=detail&aid=2166164&group_id=2915&atid=302915

>  The second thing is that I'd like to have some degree of interactivity.
> E.g. I need to allow the user to click on the y axis to draw a marker at
> the given position (and then to remove it, maybe drag it around and so on).
> I'll be using wxWidgets driver so I'd be able to draw everything I need on
> top of the plplot output but I also need some cooperation from plplot to
> translate the (pixel) coordinates in the window to the graph elements, e.g.
> I need to translate them to the values on the axes. Is this already
> possible and I just didn't find how to do it? If not, do you have any ideas
> about how anything like this could be implemented?

This is possible, at least as far as transforming coordinates back and
forth.  plcalc_world can be used to go from window coordinates to
plot-world coordinates:

http://plplot.sourceforge.net/docbook-manual/plplot-html-5.9.2/plcalc_world.html

If you need to go the other way (plot coordinates to window) then a
combo of plgvpd and plgvpw can help.  The following code is in OCaml,
but will hopefully be helpful:

(** [plxy_to_cairoxy ~x ~y context] will convert the plot world
    coordinates [x, y] to Cairo device coordinates. *)
let plxy_to_cairoxy context ~x ~y =
  (* Normalized device coordinates *)
  let nxmin, nxmax, nymin, nymax = plgvpd () in
  (* World (plot-space) coordinates *)
  let wxmin, wxmax, wymin, wymax = plgvpw () in
  (* Cairo device coordinates *)
  let xmin = context.width *. nxmin in
  let xmax = context.width *. nxmax in
  let ymin = context.height *. nymin in
  let ymax = context.height *. nymax in
  (* World coordinates -> Cairo coordinates *)
  xmin +. ((xmax -. xmin) *. (x /. (wxmax -. wxmin))),
  ymin +. ((ymax -. ymin) *. (y /. (wymax -. wymin)))

Here, context.width and context.height are the plot surface dimensions.

Hope this helps,
Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to