Thank you for your responses.
It took me a day to realize that this might be actually the best solution,
as plotting to memory will be way faster than writing to disk.
As long as we can plot to memory via plsmema( )  and then retrieve it, it
should be possible to convert the plot to a Numpy array ?
Keras takes images as arrays as per our requirement. In matplotlib this is
done behind the covers with Pillow + Numpy if I'm not wrong.
Pillow can store images as arrays in memory, so it's similar to what
plsmema( ) does. I mentioned RGBA encoded string instead of Numpy array
because I believe Pillow stores images in memory as RGBA strings, and I was
trying to find a replacement for the whole procedure ( matplotlib is
terribly slow )

It would be great to hear more comments from you about this, thanks !

On Thu, Sep 5, 2019 at 12:14 PM Xavier Cardil <cardil.xav...@gmail.com>
wrote:

> Thank you for your responses.
> It took me a day to realize that this might be actually the best solution,
> as plotting to memory will be way faster than writing to disk.
> As long as we can plot to memory via plsmema( )  and then retrieve it, it
> should be possible to convert the plot to a Numpy array ?
> Keras takes images as arrays as per our requirement. In matplotlib this is
> done behind the covers with Pillow + Numpy if I'm not wrong.
> Pillow can store images as arrays in memory, so it's similar to what
> plsmema( ) does. I mentioned RGBA encoded string instead of Numpy array
> because I believe Pillow stores images in memory as RGBA strings, and I was
> trying to find a replacement for the whole procedure ( matplotlib is
> terribly slow )
>
> It would be great to hear more comments from you about this, thanks !
>
> On Thu, Sep 5, 2019 at 10:29 AM Alan W. Irwin <alan.w.irwin1...@gmail.com>
> wrote:
>
>> On 2019-09-04 21:42-0400 Hazen Babcock wrote:
>>
>> >
>> >
>> > On 9/4/19 8:10 PM, Alan W. Irwin wrote:
>> >> On 2019-09-04 21:32+0200 Xavier Cardil wrote:
>> >>
>> >>> Hi, we are using Plplot on a project with Keras, where we are
>> required to
>> >>> feed plots as RGBA encoded string plot. Is it possible to do this
>> somehow
>> >>> ?
>> >>>
>> >>> I have read about plsmema( )
>> >>>
>> >>>
>> http://plplot.sourceforge.net/docbook-manual/plplot-html-5.15.0/plsmema.html
>> >>>
>> >>> But this looks to be a way to input, not to output ?
>> >>
>> >> Hi Xavier:
>> >>
>> >> Yes, plsmema is input so I don't think it is suitable for your
>> described
>> >> needs.
>> >
>> > Sorry it isn't clear to me what is meant by input here, so I will plow
>> ahead.
>> > The function plsmema sets the memory space for the memcairo to use when
>> > plotting. So it is input in the sense that you pass it a pointer to the
>> > memory where you want the plot rendered. But it is also output in the
>> sense
>> > that the memcairo drive will fill this memory with the plot image. If
>> you
>> > then saved this block of memory as an (RGBA) image you would see the
>> plot. If
>> > you are looking to pass pictures of plots to Keras then might be what
>> you are
>> > looking for.
>> >
>> > Though not a "official example", there is a Python example that uses
>> this
>> > function:
>> >
>> > plplot/examples/python/test_plsmem.py.in
>>
>> To Hazen and Xavier:
>>
>> @Hazen: Good points which have convinced me I should not have dismissed
>> plsmema quite so quickly.  In fact, we can
>> make no judgement about any of this until we know the exact needs of
>> Keras.
>>
>> @Xavier: To help us understand those needs, what is exact format of
>> what you call an "RGBA encoded string plot"?  I have asked for this
>> clarification because if you search for "RGBA encoded string" with
>> those quotes there are only two (java) google hits.  And there are no
>> google hits at all for "RGBA encoded string plot" with those quotes.
>>
>> Alan
>>
>> __________________________
>> Alan W. Irwin
>>
>> Programming affiliations with the FreeEOS equation-of-state
>> implementation for stellar interiors (freeeos.sf.net); the Time
>> Ephemerides project (timeephem.sf.net); PLplot scientific plotting
>> software package (plplot.org); the libLASi project
>> (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
>> and the Linux Brochure Project (lbproject.sf.net).
>> __________________________
>>
>> Linux-powered Science
>> __________________________
>>
>
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to