-
Hi, I create a CIE1931 chromaticity diagram with colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram (or alike). How can I plot a limited x,y range? I tried plt.xlim etc. But without succes. Thanks, Fred |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 7 replies
-
Hi @goofy2k, If using >>> import colour
>>> colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram(['D65'], bounding_box=[0.4, 0.6, 0, 1]) Or if you want to do it via Matplotlib, you will need to use the >>> import colour
>>> import matplotlib.pyplot as plt
>>> colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram(['D65'], standalone=False)
>>> plt.xlim([0.4, 0.6])
>>> plt.show() |
Beta Was this translation helpful? Give feedback.
-
Thanks Thomas, I will give this a try! I notice that I have to learn the
difference between colours-native plotting and the other way. I use a
headless system (server) to run the python code. So, I don't use plt.show
but save the plot in a file that I access via a browser.
Thanks, Fred
Op vr 22 jan. 2021 20:57 schreef Thomas Mansencal <[email protected]
…:
Hi @goofy2k <https://github.com/goofy2k>,
If using colour native plotting features:
>>> import colour>>> colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram(['D65'], bounding_box=[0.4, 0.6, 0, 1])
Or if you want to do it via Matplotlib, you will need to use the
standalone keyword as we are rendering/showing the figure by default:
>>> import colour>>> import matplotlib.pyplot as plt>>> colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram(['D65'], standalone=False)
(<Figure size 640x640 with 1 Axes>, <AxesSubplot:title={'center':'D65 Illuminants - Planckian Locus\nCIE 1931 Chromaticity Diagram - CIE 1931 2 Degree Standard Observer'}, xlabel='CIE x', ylabel='CIE y'>)>>> plt.xlim([0.4, 0.6])
(0.4, 0.6)>>> plt.show()
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#761 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGII3TQ5CLBYYNYYHDPQ3ODS3HKBPANCNFSM4WNUOJNA>
.
|
Beta Was this translation helpful? Give feedback.
-
OK, thanks. I succeeded to plot part of the xy space by adding the
bounding_box parameter ! I definitely have to learn how to pass
parameters, e.g. via kWargs etc. I kind of miss the experience with pyplot
/ Mathplotlib, which is evidently a requirement for using colour-science. I
have to learn this from it's docs, which is not very explanatory for a
starting user of it.
This is probably als why I have trouble removing the data points triggered
by the ['A ', 'B', 'C'] parameter in your example. I'll try to remove
that entry completely instead of replacing it by an empty list [ ].
My current code now looks like this:
annotate_kwargs = [
{'xytext': (-25, 15), 'arrowprops':{'arrowstyle':'-'}},
{'arrowprops':{'arrowstyle':'-['}},
{},
]
plot_kwargs = [
{
'markersize' : 15,
},
{ 'color': 'r'},
{},
]
colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram(
['A', 'B', 'C'], bounding_box=[0.4, 0.6, 0, 1],
annotate_kwargs=annotate_kwargs,
plot_kwargs=plot_kwargs,
standalone = False
)
I assume that I can add the parameters of render, that you showed in your
other post, to this call just like the bounding_box parameter?
Fred
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Op vr 22 jan. 2021 om 22:01 schreef Thomas Mansencal <
[email protected]>:
… Ah sweet, so all our plotting definitions can do that directly by passing
a keyword argument like that:filename=my_figure.png, most of them are
implemented in the colour.plotting.render definition that we call at the
end of all our definitions:
https://github.com/colour-science/colour/blob/develop/colour/plotting/common.py#L470
Other Parameters
----------------
figure : Figure, optional
Figure to apply the render elements onto.
axes : Axes, optional
Axes to apply the render elements onto.
filename : unicode, optional
Figure will be saved using given ``filename`` argument.
standalone : bool, optional
Whether to show the figure and call :func:`plt.show` definition.
aspect : unicode, optional
Matplotlib axes aspect.
axes_visible : bool, optional
Whether the axes are visible. Default is *True*.
bounding_box : array_like, optional
Array defining current axes limits such
`bounding_box = (x min, x max, y min, y max)`.
tight_layout : bool, optional
Whether to invoke the :func:`plt.tight_layout` definition.
legend : bool, optional
Whether to display the legend. Default is *False*.
legend_columns : int, optional
Number of columns in the legend. Default is *1*.
transparent_background : bool, optional
Whether to turn off the background patch. Default is *True*.
title : unicode, optional
Figure title.
wrap_title : unicode, optional
Whether to wrap the figure title. Default is *True*.
x_label : unicode, optional
*X* axis label.
y_label : unicode, optional
*Y* axis label.
x_ticker : bool, optional
Whether to display the *X* axis ticker. Default is *True*.
y_ticker : bool, optional
Whether to display the *Y* axis ticker. Default is *True*.
Returns
-------
tuple
Current figure and axes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGII3TW2U5FLOD7DY3TD75LS3HRTZANCNFSM4WNUOJNA>
.
|
Beta Was this translation helpful? Give feedback.
-
OK. This is about it, I think. Two questions:
1) I do not understand where my data array is. Or is this referenced by the
FL2? Where should I make that connection with my data that is eg. in
sd_power?
2) What is the background of the /100 ?
I also understand that there is trickery on board, that I probably have to
learn by doing, accompanied by reading docs
Fred
Op vr 22 jan. 2021 23:15 schreef Thomas Mansencal <[email protected]
…:
Right, so I think I understand better what you are trying to achieve here!
To display a series of custom illuminants you would do something like that:
>>> import colour>>> FL2 = colour.XYZ_to_xy(colour.sd_to_XYZ(colour.SDS_ILLUMINANTS['FL2']) / 100)>>> FL3 = colour.XYZ_to_xy(colour.sd_to_XYZ(colour.SDS_ILLUMINANTS['FL3']) / 100)>>> colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1931({'FL2': FL2, 'FL3': FL3})
[image: image]
<https://user-images.githubusercontent.com/99779/105553889-2810b700-5d6b-11eb-959e-9a65f18c13d3.png>
A few notes now on what is happening:
- The integration from spectral to CIE XYZ tristimulus values uses a
default Equal Energy illuminant, so if you want to integrate radiant power,
you don't need to pass anything besides you radiant power spectral
distribution.
- There is some magic occurring when the illuminants argument is used:
it is filtered and expanded with the
colour.plotting.common.filter_passthrough definition. The intent is to
basically be able to use the shipped dataset elements by simply using their
key but also passing arbitrary but compatible data, in this case, a mapping
of xy chromaticity coordinates. The above code could be modified like that:
>>> colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1931(['A', {'FL2': FL2, 'FL3': FL3}])
A here would be directly pulled from colour.CCS_ILLUMINANTS['CIE 1931 2
Degree Standard Observer'].
[image: image]
<https://user-images.githubusercontent.com/99779/105554370-14198500-5d6c-11eb-9679-31c05850afad.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGII3TSQDGB2KENEXLXEOHDS3H2JFANCNFSM4WNUOJNA>
.
|
Beta Was this translation helpful? Give feedback.
-
Yes, it is a 1nm sd_copy of the power distribution. Going to read the
linked part of your docs!
Fred
Op za 23 jan. 2021 00:23 schreef Thomas Mansencal <[email protected]
…:
What is sd_power here? Is it an instance of colour.SpectralDistribution?
The tutorial should give answer, to both of your questions:
https://colab.research.google.com/notebook#fileId=1Im9J7or9qyClQCv5sPHmKdyiQbG4898K&offline=true&sandboxMode=true
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGII3TQD446TCREYEN4ODJTS3ICIJANCNFSM4WNUOJNA>
.
|
Beta Was this translation helpful? Give feedback.
-
How can I write out SVG files? JUst change the file extension? It is
not in the docs....
Thanks
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Op vr 22 jan. 2021 om 22:02 schreef Thomas Mansencal <
[email protected]>:
… Oh and worth noting that you can writeout SVG files!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGII3TSC5XDLGXU7IB77IDLS3HRYBANCNFSM4WNUOJNA>
.
|
Beta Was this translation helpful? Give feedback.
-
OK, thanks! I have no experience with it. I probably have to adapt my UI,
where I want to use this output...
Fred
Op di 26 jan. 2021 12:24 schreef Thomas Mansencal <[email protected]
…:
Not everything is, and especially when it is Matplotlib feature, but yes,
changing extension is the way! :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGII3TSZLRKYP4WVIEKGIP3S32RANANCNFSM4WNUOJNA>
.
|
Beta Was this translation helpful? Give feedback.
Hi @goofy2k,
If using
colour
native plotting features:Or if you want to do it via Matplotlib, you will need to use the
standalone
keyword as we are rendering/showing the figure by default: