using VegaLite, VegaDatasets
dataset("cars") |>
@vlplot(:point, x=:Horsepower, y=:Miles_per_Gallon)
0 50 100 150 200 Horsepower 0 10 20 30 40 50 Miles_per_Gallon
using VegaLite, VegaDatasets
dataset("seattle-weather") |>
@vlplot(:tick, x=:precipitation)
0 10 20 30 40 50 60 precipitation
using VegaLite, VegaDatasets
dataset("cars") |>
@vlplot(:tick, x=:Horsepower, y="Cylinders:o")
0 50 100 150 200 Horsepower 3 4 5 6 8 Cylinders
using VegaLite, VegaDatasets
dataset("cars") |>
@vlplot(:point, x=:Horsepower, y=:Miles_per_Gallon, color=:Origin, shape=:Origin)
0 50 100 150 200 Horsepower 0 10 20 30 40 50 Miles_per_Gallon Europe Japan USA Origin
using VegaLite, VegaDatasets
dataset("movies") |>
@vlplot(
:circle,
x={:IMDB_Rating, bin={maxbins=10}},
y={:Rotten_Tomatoes_Rating, bin={maxbins=10}},
size="count()"
)
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 IMDB_Rating (binned) 0 10 20 30 40 50 60 70 80 90 100 Rotten_Tomatoes_Rating (binned) 50 100 150 Count of Records
using VegaLite, VegaDatasets
dataset("cars") |>
@vlplot(:point, x=:Horsepower, y=:Miles_per_Gallon, size=:Acceleration)
0 50 100 150 200 Horsepower 0 10 20 30 40 50 Miles_per_Gallon 5 10 15 20 Acceleration
using VegaLite, VegaDatasets
dataset("movies") |>
@vlplot(
:point,
x=:IMDB_Rating,
y=:Rotten_Tomatoes_Rating,
color={
condition={
test="datum.IMDB_Rating === null || datum.Rotten_Tomatoes_Rating === null",
value="#aaa"
}
},
config={invalidValues=nothing}
)
0 2 4 6 8 10 IMDB_Rating 0 20 40 60 80 100 Rotten_Tomatoes_Rating
using VegaLite, VegaDatasets
dataset("cars") |>
@vlplot(:circle, x=:Horsepower, y=:Miles_per_Gallon)
0 50 100 150 200 Horsepower 0 10 20 30 40 50 Miles_per_Gallon
using VegaLite, VegaDatasets
dataset("gapminder-health-income") |>
@vlplot(
:circle,
width=500,height=300,
selection={
view={type=:interval, bind=:scales}
},
y={:health, scale={zero=false}, axis={minExtent=30}},
x={:income, scale={type=:log}},
size=:population,
color={value="#000"}
)
100 200 1,000 2,000 10,000 20,000 100,000 200,000 1,000,000 income 45 50 55 60 65 70 75 80 85 health 200,000,000 400,000,000 600,000,000 800,000,000 1,000,000,000 1,200,000,000 population
using VegaLite, VegaDatasets
dataset("disasters") |>
@vlplot(
width=600,height=400,
transform=[
{filter="datum.Entity !== 'All natural disasters'"}
],
mark={
:circle,
opacity=0.8,
stroke=:black,
strokeWidth=1
},
x={"Year:o", axis={labelAngle=0}},
y={:Entity, axis={title=""}},
size={
:Deaths,
legend={title="Annual Global Deaths"},
scale={range=[0,5000]}
},
color={:Entity, legend=nothing}
)
1900 1901 1902 1903 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 Year Drought Earthquake Epidemic Extreme temperature Extreme weather Flood Landslide Mass movement (dry) Volcanic activity Wildfire 1,000,000 2,000,000 3,000,000 Annual Global Deaths
using VegaLite, VegaDatasets
dataset("cars") |>
@vlplot(
:text,
transform=[
{
calculate="datum.Origin[0]",
as="OriginInitial"
}
],
x=:Horsepower,
y=:Miles_per_Gallon,
color=:Origin,
text="OriginInitial:n"
)
0 50 100 150 200 Horsepower 0 10 20 30 40 50 Miles_per_Gallon U U U U U U U U U U U U U U J U U U J E E E E E U U U U U J U J U U U U U U U U U U U U U U U U U E E E J J E U J U E U U U U U U U U U U U J U U U U E E E E U J J U J U U U U U U U U U U U U U U U U U E U U U U U J U J J U U E U U E E E E U E J U U U U J U J U U U U U U U U U E E E J J U E E J J E U U U U U U U U U U U U U U U J U U U J E J U E U E E E E J E E U U E U U U U U U U U U U E J U U U U E J J U E U E J E U U U U J U E U J U U U U U U U U U U U U E U J U U U J E J E J E U J J J U U U U U U U U U U U U U U U U U U J J U J U U J E E E E E J U U U U U U U U U U U U U E J U U E U E U U U J E U U U U E J U J U U U U E J J J J J U J E E E E J J E J J E J U U U U U J U J J J J J U U U E J J J J E E J J U U U U U U U U U U U E J J U U J J J J J J U U U U J U U U E U U U Europe Japan USA Origin
using VegaLite, VegaDatasets, DataFrames
data=DataFrame(
x=[0.5,1.5,2.5],
y=[0.5,1.5,2.5],
#use the following code to reproduce on a local REPL:
# Construct the URL to the local example images with absolute paths:
# file:///C:/Users/username/.julia/packages/VegaDatasets/9E5lE/src/../data/data/ffox.png
# img=[
# "file:///"*replace(joinpath(joinpath(dirname(pathof(VegaDatasets)),"..","data"),"data","ffox.png"),"\\" => "/"),
# "file:///"*replace(joinpath(joinpath(dirname(pathof(VegaDatasets)),"..","data"),"data","gimp.png"),"\\" => "/"),
# "file:///"*replace(joinpath(joinpath(dirname(pathof(VegaDatasets)),"..","data"),"data","7zip.png"),"\\" => "/")
# ]
img=[
"../../assets/images/ffox.png",
"../../assets/images/gimp.png",
"../../assets/images/7zip.png"
]
)
data |> @vlplot(
mark={:image,width=50,height=50},
x="x:q",
y="y:q",
url={field=:img}
)
0.0 0.5 1.0 1.5 2.0 2.5 x 0.0 0.5 1.0 1.5 2.0 2.5 y