just found the solution without having to compile from source, ubuntu 18
has plplot-driver-qt package


On Mon, Sep 16, 2019 at 6:50 PM Xavier Cardil <cardil.xav...@gmail.com>
wrote:

> I am implementing plsmema as discussed, but after installing all QT5 dev
> libs, plplot is not showing the memqt option to plot, which means I am
> missing something. Do I have to compile from source enabling memqt perhaps
> ? Is there any post around that I can refer to ?
>
> Thanks !
>
> On Thu, Sep 5, 2019 at 8:15 PM Xavier Cardil <cardil.xav...@gmail.com>
> wrote:
>
>> That's great, thanks for the example Hazen ! I'll be implementing this in
>> the following days
>>
>> On Thu, Sep 5, 2019 at 5:52 PM Hazen Babcock <hbabc...@mac.com> wrote:
>>
>>> On 9/5/19 6:16 AM, Xavier Cardil 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 !
>>> >
>>>
>>> Here is an example (using the "memqt" driver, but "memcairo" should also
>>> work).
>>>
>>> #!/usr/bin/env python3
>>>
>>> from PIL import Image
>>>
>>> import numpy
>>> import plplot
>>>
>>> width = 480
>>> height = 320
>>> plot_buffer = numpy.zeros((height, width, 4), numpy.uint8)
>>>
>>> plplot.plsmema(width, height, plot_buffer)
>>>
>>> plplot.plstart("memqt", 1, 1)
>>> plplot.plenv(0, 360, 0, 90, 0, 2)
>>> plplot.plend1()
>>>
>>> plot_image = Image.frombytes("RGBA", (width, height), plot_buffer)
>>> plot_image.save("image.png")
>>>
>>>
>>> The final plot is available in the plot_buffer numpy array object, or in
>>> the plot_image PIL/Pillow Image object.
>>>
>>> -Hazen
>>>
>>
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to