Discussion:
Viewer Feature Request / Clarification
Kevin Blondino
2018-03-19 16:35:31 UTC
Permalink
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
Michael J. Waters
2018-03-19 16:48:44 UTC
Permalink
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
Post by Kevin Blondino
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
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Daniel Lewis
2018-03-19 18:16:12 UTC
Permalink
One of the examples in the manual shows this, I think?

If you get stuck, e-mail me directly and I can send you an example from
one of my simulations. When you get something working you can post it
back to the mailing list.

Thanks,
Dan
--
Dan Lewis
Materials Science and Engineering
Materials Research Center 110
Rensselaer Polytechnic Institute
110 8th Street
Troy, NY 12180
***@rpi.edu
518-276-2297
Post by Michael J. Waters
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
Post by Kevin Blondino
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
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fip
y ]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Guyer, Jonathan E. Dr. (Fed)
2018-03-20 13:21:50 UTC
Permalink
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://github.com/usnistgov/fipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/matplotlibViewer/matplotlib1DViewer.py#L82 and following, add a `color=` argument to the creation of the lines.

* In Matplotlib1DViewer._plot(), after https://github.com/usnistgov/fipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/matplotlibViewer/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://www.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.anisotropy.html and https://www.ctcms.nist.gov/fipy/examples/phase/generated/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
Post by Michael J. Waters
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
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
http://www.ctcms.nist.gov/fipy
https://email.nist.gov/mailman/listinfo/fipy
]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Michael J. Waters
2018-03-20 13:47:51 UTC
Permalink
Hi Jonathan,

Sorry to disappoint you.

Kevin,

If you have time, what Jonathon said is /much/ better. Code contribution
is very important to open source projects!

Best,

-Mike
Post by Guyer, Jonathan E. Dr. (Fed)
* In Matplotlib1DViewer.__init__(), around https://github.com/usnistgov/fipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/matplotlibViewer/matplotlib1DViewer.py#L82 and following, add a `color=` argument to the creation of the lines.
* In Matplotlib1DViewer._plot(), after https://github.com/usnistgov/fipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/matplotlibViewer/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://www.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.anisotropy.html and https://www.ctcms.nist.gov/fipy/examples/phase/generated/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
Post by Michael J. Waters
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
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
http://www.ctcms.nist.gov/fipy
https://email.nist.gov/mailman/listinfo/fipy
]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Guyer, Jonathan E. Dr. (Fed)
2018-03-20 15:53:28 UTC
Permalink
No worries. Dan Wheeler is guilty of the same misconduct.
Post by Michael J. Waters
Hi Jonathan,
Sorry to disappoint you.
Kevin,
If you have time, what Jonathon said is much better. Code contribution is very important to open source projects!
Best,
-Mike
Post by Guyer, Jonathan E. Dr. (Fed)
* In Matplotlib1DViewer.__init__(), around
https://github.com/usnistgov/fipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/matplotlibViewer/matplotlib1DViewer.py#L82
and following, add a `color=` argument to the creation of the lines.
* In Matplotlib1DViewer._plot(), after
https://github.com/usnistgov/fipy/blob/71d82e1cc7b2c4e7c1c996d038fd8542d7e4c5a1/fipy/viewers/matplotlibViewer/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://www.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.anisotropy.html and https://www.ctcms.nist.gov/fipy/examples/phase/generated/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
Post by Michael J. Waters
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
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
http://www.ctcms.nist.gov/fipy
https://email.nist.gov/mailman/listinfo/fipy
]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
https://email.nist.gov/mailman/listinfo/fipy
]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
https://email.nist.gov/mailman/listinfo/fipy
]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Daniel Lewis
2018-03-22 11:37:15 UTC
Permalink
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://gist.github.com/kablondino/0cc44c3ea4e807b8e2088adbe40ef142

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
***@rpi.edu
518-276-2297
Post by Guyer, Jonathan E. Dr. (Fed)
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
* In Matplotlib1DViewer.__init__(), around https://github.com/usnistg
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://github.com/usnistgov/f
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
Post by Michael J. Waters
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
Post by Kevin Blondino
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
http://www.ctcms.nist.gov/fipy
https://email.nist.gov/mailman/listinfo/fipy
]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Guyer, Jonathan E. Dr. (Fed)
2018-03-22 15:45:14 UTC
Permalink
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?
Post by Daniel Lewis
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
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
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
518-276-2297
Post by Guyer, Jonathan E. Dr. (Fed)
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
* 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
Post by Michael J. Waters
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
Post by Kevin Blondino
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
http://www.ctcms.nist.gov/fipy
https://email.nist.gov/mailman/listinfo/fipy
]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Loading...