On `force_ascii` and support for Unicode characters
NikosAlexandris opened this issue · 8 comments
The force_ascii
option is useful, reportedly, to Force ASCII characters for plotting only. This can be useful for compatibility, for example when using uniplot inside of CI/CD systems that do not support Unicode. Defaults to False.
I am fighting with this : I still can't get a regularly looking output, executed commands from inside a markdown-exec executable code block.
Finally, and however, I got to access a docker image where I can update locales, etc. I am trying to install some fonts and set LC_ALL
etc., but I still cannot get the output appear as expected. See also : pawamoy/markdown-exec#45 (reply in thread). What can I do to ensure uniplot/s are rendered correctly ?
Hi @NikosAlexandris could you post an example of the uniplot function you are calling, and the output you are seeing?
With force_ascii=True
and perhaps color=False
you should not have any problems, but I'd be curious to see your case
Hi @NikosAlexandris could you post an example of the uniplot function you are calling, and the output you are seeing?
With
force_ascii=True
and perhapscolor=False
you should not have any problems, but I'd be curious to see your case
Thank you for the reply. Struggling here to understand how I should set up the CI/CD environment to make things looks okay. Locally, I see no problems. "Remotely" I see things (exactly actually) like in this page : https://nikosalexandris.github.io/rekx/how_to/help/#help (see end of code block rekx --help
).
I have even set now both locally and for CI/CD build (not the rekx
example above, but another project)
theme:
font: false
in mkdocs.yml
.
For Uniplot/s, I use something like
import shutil
from functools import partial
from uniplot import plot as default_plot
terminal_columns, _ = shutil.get_terminal_size() # we don't need lines!
terminal_length = int(terminal_columns * terminal_width_fraction)
plot = partial(default_plot, width=terminal_length)
then using this somewhere
# some code
plot(
# xs=timestamps,
ys=y_series,
legend_labels=legend_labels,
lines=lines,
title=title if title else supertitle,
y_unit=' ' + str(unit),
# force_ascii=True,
)
to renders plots fine locally (with or without explicitly export FORCE_COLOR=1
)
but not when the documentation is build through the CI/CD image
Since this mis-alignment appears on other blocks too, irrelevant to Uniplot, I think it's a font / Unicode related issue. !?
It does look like a font issue. Could you try 2 things:
- Use
force_ascii=True
, then the output should display identically. Though of course you loose the Unicode-powered high resolution. - Use
color=False
and see what you get.
Thanks!
It does look like a font issue. Could you try 2 things:
1. Use `force_ascii=True`, then the output should display identically. Though of course you loose the Unicode-powered high resolution. 2. Use `color=False` and see what you get.
Thanks!
@olavolav This is about uniplot
and color=False
, and not about the problem I am trying to resolve.
While testing locally, I get
Maybe the "legend" slips away the color=False
option ?
@NikosAlexandris Thanks for pointing this out! Indeed, that's not correct behavior, have opened #33 to track that. I have a fix locally already.
@NikosAlexandris Now that #33 is closed, can we close this ticket here as well?
@NikosAlexandris Closing this for now, let me now if there is anything else you need.