File tree 1 file changed +21
-11
lines changed
1 file changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -45,25 +45,35 @@ def _():
45
45
import altair as alt
46
46
from vega_datasets import data
47
47
48
- return (
49
- alt .Chart (data .cars ())
50
- .mark_point ()
51
- .encode (
52
- x = "Horsepower" ,
53
- y = "Miles_per_Gallon" ,
54
- color = "Origin" ,
48
+ source = data .stocks ()
49
+
50
+ return alt .Chart (source ).transform_filter (
51
+ 'datum.symbol==="GOOG"'
52
+ ).mark_area (
53
+ tooltip = True ,
54
+ line = {'color' : '#0281CD' },
55
+ color = alt .Gradient (
56
+ gradient = 'linear' ,
57
+ stops = [alt .GradientStop (color = 'white' , offset = 0 ),
58
+ alt .GradientStop (color = '#0281CD' , offset = 1 )],
59
+ x1 = 1 , x2 = 1 , y1 = 1 , y2 = 0
55
60
)
61
+ ).encode (
62
+ alt .X ('date:T' ),
63
+ alt .Y ('price:Q' )
64
+ ).properties (
65
+ title = {"text" : ["Google's stock price over time" ]}
56
66
)
57
67
58
68
@output (id = "plotly" )
59
69
@render_widget
60
70
def _ ():
61
71
import plotly .express as px
62
72
63
- return px .scatter (
64
- x = np . random . randn ( 100 ),
65
- y = np . random . randn ( 100 ) ,
66
- color = np . random . randn ( 100 ),
73
+ return px .density_heatmap (
74
+ px . data . tips ( ),
75
+ x = "total_bill" , y = "tip" ,
76
+ marginal_x = "histogram" , marginal_y = "histogram"
67
77
)
68
78
69
79
@output (id = "ipyleaflet" )
You can’t perform that action at this time.
0 commit comments