Dash/Plotly layout rendering differently on another computer after the deploy - python

I just deployed a dashboard on Google Cloud and shared it with a friend to check if he could access it. I asked for a screen print to check if everything was ok.
To my surprise, the dashboard that appeared to him is very different from what appears to me. On his screen, the text fonts are all misconfigured and the size of the graphics are different, in addition to not being centered on the screen.
I didn't think this problem would happen, since the dash is online on the internet.
Can anyone tell me how I can standardize the view for any user?
I don't know if it helps but all the layout code (html+css+python) is in the same app.py file.
Obs
There is no Go.figures or Bootstrap in my code. It's just simples plotly charts made with plotly.express.

Related

Set window size for Ursina Engine for Python

I'm using Ursina Engine to make a game. However I can't figure out a way how to set a specific size for the window. I need to figure this out, because I can't see part of it, because it's bigger than my screen.
I tried to use other posts on StackOverflow, but couldn't find anything. I also tried to use ChatGPT, however it didn't help.
A google search led me to the documentation of the engine, where I found this:
https://www.ursinaengine.org/api_reference.html
As I understand it your main app class Ursina(), can accept various arguments, including amongst others 'size'.
Scrolling further down to the part named 'ASCIIEditor' there's an example usage:
app = Ursina(size=(1920,1080))
My experience with Ursina is limited to some introductory videos, so take this for what it is.

R Shiny equivalent in Python? Creating a window-based tool

I am trying to transfer an app i build in R Shiny to Python Code.
It's main use is to set the input parameters for a data analysis to be run which should create and output pdf file.
So far I managed to understand that DASH might be the tool to go with. But is there a way to launch a DASH app in an external window (not in a browser window)? Like the following:
After setting the Input values I want to have a button to click "Run" or something similiar to run the underlying code and generate a PDF Report. How would you do that with Python and do you maybe know a good Tutorial how to build a basic app like this?
I'm not exactly sure what you mean in the first part of your question. You may be able to use an IDE with integrated broswer to view your app during developement if you don't want to use a broswer. But the whole point of dash is to be a web based application, so it would be best on a browser.
Alternately, you can save the rendered output from browser to a .html file if you need to share it without having a live server host your application.
For the second part of your question, for a button click to generate a pdf report, refer to the documentation of callback in dash.
The callback function for the Run Analysis button can then be something on the lines of
def generate_report():
#Code to generate required pdf
# Code to download on client
return link_to_pdf
Hope this gives some pointers in the direction.

Why are Folium maps not displayed in Jupyter Notebooks

I want to display a simple map with Folium in Jupyter notebooks.
The code below (and as shown in the picture) should work in Jupyter notebooks, but instead of displaying a map I just get an empty space.
# define the world map
world_map = folium.Map()
# display world map
world_map
I already tried restarting the kernel and using different browsers (safari, chrome). I also made sure that no content blocker is active. But no difference.
Does anyone know what I need to do to be able to see the map?
With a little help from my friends I managed to find the root cause. The problem were the firewall settings in the router. Some servers, where the folium maps got their data from, were blacklisted. That's why the maps were not displayed.

Some svg animations play in GitHub README others do not

I have been checking out some terminal to svg recorders like termtosvg written in Python and svg-term-cli in Typescript.
I installed termtosvg and recorded a small terminal session to keep in my README as a demo. However github doesn't render it. Strangely it renders all the svg animations that termtosvg has.
svg-term-cli is using Rawgit to render, but I don't want to use it as it will be taken down.
I made a small repository for testing purposes here. I downloaded one svg from termtosvg, one from svg-term-cli and one of my own and put it in docs folder in the repo. And linked to them from my README.md.
Issue
The svg animation from svg-term-cli renders in README however the other two don't.
NOTE:
Inside docs folder I can clearly see Github rendering the animated svgs.
I'd like to use termtosvg and not svg-term-cli.
Why is this happening? How do I make README render my animated svg.
I had a chat with the creators of termtosvg and found out that termtosvg uses animation tags which GitHub considers as scripts thereby removing them. That's why we see just a black screen and no animation when we try to link svgs output by termtosvg.
svg-term-cli and the shark animation on the other hand uses CSS to achieve the same thing which GitHub doesn't seem to have an issue with. That's why they get rendered.
Possible workarounds:
Using github.io to host the images and link that to README as that seems to work.
Using Rawgit. But keeping in mind that it will be taken down soon.

Make a plot visible in IE

I've been making plots in Bokeh, they work fine in Chrome, but I just get blank pages in IE. I thought this was because my company uses IE8 by default, but we've now been upgraded to IE11 and I see the same problem.
The IE debug console reports that the page targets document mode 7, so it may be an issue with the metadata in the page header.
Is there a way to make Bokeh output plots with the correct metadata for IE?
I ran into a similar issue with a Bokeh figure at work not showing in Internet Explorer, but the figure worked fine in other browsers.
For me the problem seemed to be that intranet sites were shown in Compatability View (I must admit I don't know what Compatability View means...). The fix was to choose the options icon in the upper right corner, then Compatibility View Settings and then remove the checkmark at Display intranet sites in Compatibility View. After close and reload the figure appeared.
We regularly test on IE before release, so I am not sure what the issue could be. You can definitely get just the plot components using various functions in bokeh.embed and template them into what whatever larger documents you like, but perhaps the default template needs updating or tweaking. I don't know what "document mode 7" is, but some of the other devs might be more familiar with IE and can help investigate. In any case I encourage you to make a proper issue not the GitHub issue tracker:
https://github.com/bokeh/bokeh/issues
Also had this issue with IE11.
I fixed it by removing webgl=True option from bokeh.plotting.figure() call.
cf. [http://docs.bokeh.org/en/0.11.1/docs/user_guide/webgl.html]

Categories

Resources