File size: 8,948 Bytes
7a04bbd
672c30d
 
 
7a04bbd
672c30d
 
 
 
 
 
 
 
 
 
 
 
 
7a04bbd
672c30d
 
 
 
 
7a04bbd
 
 
672c30d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
import streamlit as st
import plotly.express as px
import plotly.graph_objects as go
import inspect

@st.experimental_memo
def get_chart_29333332():
    import plotly.express as px
    
    fig = px.imshow([[1, 20, 30],
                     [20, 1, 60],
                     [30, 60, 1]])
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_29333332))
    get_chart_29333332()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_41983230():
    import plotly.express as px
    
    df = px.data.medals_wide(indexed=True)
    fig = px.imshow(df)
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_41983230))
    get_chart_41983230()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_8045850():
    import plotly.express as px
    
    z = [[.1, .3, .5, .7, .9],
         [1, .8, .6, .4, .2],
         [.2, 0, .5, .7, .9],
         [.9, .8, .4, .2, 0],
         [.3, .4, .5, .7, 1]]
    
    fig = px.imshow(z, text_auto=True)
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_8045850))
    get_chart_8045850()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_79075482():
    import plotly.express as px
    
    z = [[.1, .3, .5, .7, .9],
         [1, .8, .6, .4, .2],
         [.2, 0, .5, .7, .9],
         [.9, .8, .4, .2, 0],
         [.3, .4, .5, .7, 1]]
    
    fig = px.imshow(z, text_auto=True, aspect="auto")
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_79075482))
    get_chart_79075482()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_12486592():
    import plotly.express as px
    data=[[1, 25, 30, 50, 1], [20, 1, 60, 80, 30], [30, 60, 1, 5, 20]]
    fig = px.imshow(data,
                    labels=dict(x="Day of Week", y="Time of Day", color="Productivity"),
                    x=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
                    y=['Morning', 'Afternoon', 'Evening']
                   )
    fig.update_xaxes(side="top")
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_12486592))
    get_chart_12486592()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_63882696():
    import plotly.express as px
    import xarray as xr
    # Load xarray from dataset included in the xarray tutorial
    airtemps = xr.tutorial.open_dataset('air_temperature').air.sel(lon=250.0)
    fig = px.imshow(airtemps.T, color_continuous_scale='RdBu_r', origin='lower')
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_63882696))
    get_chart_63882696()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_97846046():
    import plotly.graph_objects as go
    
    fig = go.Figure(data=go.Heatmap(
                        z=[[1, 20, 30],
                          [20, 1, 60],
                          [30, 60, 1]]))
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_97846046))
    get_chart_97846046()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_37340223():
    import plotly.graph_objects as go
    
    fig = go.Figure(data=go.Heatmap(
                       z=[[1, None, 30, 50, 1], [20, 1, 60, 80, 30], [30, 60, 1, -10, 20]],
                       x=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
                       y=['Morning', 'Afternoon', 'Evening'],
                       hoverongaps = False))
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_37340223))
    get_chart_37340223()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_20250490():
    import plotly.graph_objects as go
    import numpy as np
    
    # Build the rectangles as a heatmap
    # specify the edges of the heatmap squares
    phi = (1 + np.sqrt(5) )/2. # golden ratio
    xe = [0, 1, 1+(1/(phi**4)), 1+(1/(phi**3)), phi]
    ye = [0, 1/(phi**3), 1/phi**3+1/phi**4, 1/(phi**2), 1]
    
    z = [ [13,3,3,5],
          [13,2,1,5],
          [13,10,11,12],
          [13,8,8,8]
        ]
    
    fig = go.Figure(data=go.Heatmap(
              x = np.sort(xe),
              y = np.sort(ye),
              z = z,
              type = 'heatmap',
              colorscale = 'Viridis'))
    
    # Add spiral line plot
    
    def spiral(th):
        a = 1.120529
        b = 0.306349
        r = a*np.exp(-b*th)
        return (r*np.cos(th), r*np.sin(th))
    
    theta = np.linspace(-np.pi/13,4*np.pi,1000); # angle
    (x,y) = spiral(theta)
    
    fig.add_trace(go.Scatter(x= -x+x[0], y= y-y[0],
         line =dict(color='white',width=3)))
    
    axis_template = dict(range = [0,1.6], autorange = False,
                 showgrid = False, zeroline = False,
                 linecolor = 'black', showticklabels = False,
                 ticks = '' )
    
    fig.update_layout(margin = dict(t=200,r=200,b=200,l=200),
        xaxis = axis_template,
        yaxis = axis_template,
        showlegend = False,
        width = 700, height = 700,
        autosize = False )
    
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_20250490))
    get_chart_20250490()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_54456624():
    import plotly.graph_objects as go
    import datetime
    import numpy as np
    np.random.seed(1)
    
    programmers = ['Alex','Nicole','Sara','Etienne','Chelsea','Jody','Marianne']
    
    base = datetime.datetime.today()
    dates = base - np.arange(180) * datetime.timedelta(days=1)
    z = np.random.poisson(size=(len(programmers), len(dates)))
    
    fig = go.Figure(data=go.Heatmap(
            z=z,
            x=dates,
            y=programmers,
            colorscale='Viridis'))
    
    fig.update_layout(
        title='GitHub commits per day',
        xaxis_nticks=36)
    
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_54456624))
    get_chart_54456624()
except Exception as e:
    st.exception(e)



@st.experimental_memo
def get_chart_69344836():
    import plotly.graph_objects as go
    
    fig = go.Figure(data=go.Heatmap(
                        z=[[1, 20, 30],
                          [20, 1, 60],
                          [30, 60, 1]],
                        text=[['one', 'twenty', 'thirty'],
                              ['twenty', 'one', 'sixty'],
                              ['thirty', 'sixty', 'one']],
                        texttemplate="%{text}",
                        textfont={"size":20}))
    
    
    tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"])
    with tab1:
        st.plotly_chart(fig, theme="streamlit")
    with tab2:
        st.plotly_chart(fig, theme=None)

try:
    st.expander("See code").code(inspect.getsource(get_chart_69344836))
    get_chart_69344836()
except Exception as e:
    st.exception(e)