-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Axis: add support for image labels #4503
Comments
I don't have a direct answer for you I'm afraid. But as work around, could you render the latex to a bitmap and display that? (assuming its not constantly changing) |
Do you mean that I can turn the latex into the graph and use this graph as the label text or legend? It seams OK in scottplot4, but I do not find this kind of method in scottplot5. |
Note that superscript and subscript numbers are possible now using unicode: formsPlot1.Plot.YLabel("PSI²");
formsPlot1.Plot.XLabel("H₂CO₃");
This should work, but I don't recall whether images are supported in the common places (axis labels, legend items, etc.). I'll modify this issue to track adding (or documenting) how this may be achieved. Related: |
I'm merging #4517 now and this feature will be available in the next release! If you use a third party package to render rich text as a bitmap, you can consume it with ScottPlot and display it anywhere a label is typically displayed myPlot.Add.Signal(Generate.Sin(51));
myPlot.Add.Signal(Generate.Cos(51));
// This array holds the bytes of a bitmap. Here it's generated,
// but it could be a byte array read from a bitmap file on disk.
byte[] bytes1 = SampleImages.NoisyText("Horiz", 150, 50).GetImageBytes();
byte[] bytes2 = SampleImages.NoisyText("Vert", 150, 50).GetImageBytes();
// Create a ScottPlot.Image from the bitmap bytes
ScottPlot.Image img1 = new(bytes1);
ScottPlot.Image img2 = new(bytes2);
// Display the image for the bottom axis label
myPlot.Axes.Bottom.Label.Image = img1;
myPlot.Axes.Left.Label.Image = img2; |
While I can get a capital omega as a label, unicode doesn't work in general in Maui. I would appreciate knowing how to get this to work though. Using this code
As a (funny) sidenote, ChatGPT thinks ScottPlot supports Latex formatted labels. I suspect that's an hallucination from the above discussion 😆 |
Recently, I am using scottplot for scientific drawing. When I need to set the unit for the label and legend, I have to use superscript and subscript. I know that some special unicode can be used. But if the content is more complicated, I have no idea what to do. Besides, I need to add some Latex formula into the plot. For example, I want to add -x^{-rho} into the plot.
So, I want to know if there are some ways for me to do so? Will scottplot add this kind of function in the future?
ScottPlot Version: 5.0.43.0
The text was updated successfully, but these errors were encountered: