Your solution is fine; it just doesn't generalize.

Consider that we make no promise that mesh.x is even in ascending order. In my 
view, it's better to let us worry about tying together geometry, topology, and 
data, and you worry about presentation via subclassing. If that model only 
makes sense to me, I can learn to live with that.

What's illustrated in fipy.viewers.matplotlibViewer.test, btw?

> On Mar 22, 2018, at 7:37 AM, Daniel Lewis <lewi...@rpi.edu> wrote:
> 
> Hi John, et al.
> 
> I'm sorry in advance if I'm missing the point.  I think FiPy does a
> nice job of giving the user tools to do visualizations.  With respect
> to multiple viewers, this is what I was thinking of:
> 
> https://www.ctcms.nist.gov/fipy/fipy/generated/fipy.viewers.matplotlibV
> iewer.html#module-fipy.viewers.matplotlibViewer.test
> 
> Admittedly the design of FiPy and the intended usage example above does
> everything (and more) that I do in my snippet here:
> 
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fkablondino%2F0cc44c3ea4e807b8e2088adbe40ef142&data=02%7C01%7Cjonathan.guyer%40nist.gov%7C3df2f9c1cf9b4f398cd808d58fe96a9c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636573155048426975&sdata=2LrLtsiR59XcmMDu1zUvma4Yd261RGV6HZCJJ8JZrNE%3D&reserved=0
> 
> Maybe my approach isn't general enough?
> 
> Thanks again for FiPy.
> 
> Best,
> Dan
> 
> -- 
> Dan Lewis
> Materials Science and Engineering
> Materials Research Center 110
> Rensselaer Polytechnic Institute
> 110 8th Street
> Troy, NY 12180
> lewi...@rpi.edu
> 518-276-2297
> 
> On Tue, 2018-03-20 at 13:21 +0000, Guyer, Jonathan E. Dr. (Fed) wrote:
>> I must confess that this answer makes me sad. FiPy is object oriented
>> precisely so that you don't need to do this. The intended design is
>> that you subclass Matplotlib1DViewer to override the behavior you
>> want. There are two places you can do this:
>> 
>> * In Matplotlib1DViewer.__init__(), around 
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusnistg&data=02%7C01%7Cjonathan.guyer%40nist.gov%7C3df2f9c1cf9b4f398cd808d58fe96a9c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636573155048426975&sdata=KPe4Bm%2BJ8iAwsSIRq%2BGsZPHZvU7F%2F51%2BaPA4t8Vff0Y%3D&reserved=0
>> ov/fipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/ma
>> tplotlibViewer/matplotlib1DViewer.py#L82 and following, add a
>> `color=` argument to the creation of the lines.
>> 
>> * In Matplotlib1DViewer._plot(), after 
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusnistgov%2Ff&data=02%7C01%7Cjonathan.guyer%40nist.gov%7C3df2f9c1cf9b4f398cd808d58fe96a9c%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636573155048426975&sdata=sKW13ir85JXFTmSaNkBDWHBN9I1Z%2FghRefxBuvHrlaE%3D&reserved=0
>> ipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/matplo
>> tlibViewer/matplotlib1DViewer.py#L145, add a `line[0].set_color()`
>> call.
>> 
>> In addition to subclassing for your own purposes, a pull request that
>> adds this capability to Matplotlib1DViewer would be most welcome.
>> 
>> P.S. I think Dan Lewis is thinking of the custom viewers in https://w
>> ww.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.anisot
>> ropy.html and https://www.ctcms.nist.gov/fipy/examples/phase/generate
>> d/examples.phase.polyxtal.html. Neither does the specific
>> customization you are looking for, but they illustrate how
>> subclassing a Viewer class is intended to work.
>> 
>> - Jon
>> 
>>> On Mar 19, 2018, at 12:48 PM, Michael J. Waters <waters.mike.j@gmai
>>> l.com> wrote:
>>> 
>>> Hi Kevin,
>>> 
>>> If you are using the Matplotlib Viewers, you could just skip the
>>> Viewers and use Matplotlib directly.  it's not hard to simply setup
>>> subplots using Matplotlib and it should be easy to get them to
>>> update the figure at each time step. 
>>> Best,
>>> 
>>> -Mike
>>> 
>>> 
>>> On 3/19/18 11:35 AM, Kevin Blondino wrote:
>>>> Hi,
>>>> 
>>>> My problem is one-dimensional. When plotting, I wish to have
>>>> side-by-side plots of separate cell variables. The color of the
>>>> lines default to a color scheme, i.e. the first line of each
>>>> subplot is blue, etc. I wish to have the viewer allow me to
>>>> choose the color of the line. Does this already exist? Or would I
>>>> have to export it as a TSV and plot it under my own accord? I
>>>> scoured the documentation and archive with no avail.
>>>> 
>>>> Thanks,
>>>> Kevin
>>>> 
>>>> 
>>>> _______________________________________________
>>>> fipy mailing list
>>>> 
>>>> fipy@nist.gov
>>>> http://www.ctcms.nist.gov/fipy
>>>> 
>>>>  [ NIST internal ONLY: 
>>>> https://email.nist.gov/mailman/listinfo/fipy
>>>> ]
>>>> 
>>> 
>>> _______________________________________________
>>> fipy mailing list
>>> fipy@nist.gov
>>> http://www.ctcms.nist.gov/fipy
>>> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy
>>> ]
>> 
>> 
>> _______________________________________________
>> fipy mailing list
>> fipy@nist.gov
>> http://www.ctcms.nist.gov/fipy
>>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy
>> ]
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to