Themes

Many parameters controlling the appearance of plots can be overridden by passing a Theme object to the plot function, or setting the Theme as the current theme using push_theme or with_theme.

The constructor for Theme takes zero or more keyword arguments each of which overrides the default value of the corresponding field. See Theme for a full list of keywords.

using Gadfly, RDatasets
mammals = dataset("MASS", "mammals")
plot(mammals, x=:Body, y=:Brain, label=:Mammal,
     Geom.point, Geom.label, Scale.x_log10, Scale.y_log10,
     Theme(discrete_highlight_color=x->"red", default_color="white"))
Body 10-4 10-2 100 102 104 10-4.0 10-3.5 10-3.0 10-2.5 10-2.0 10-1.5 10-1.0 10-0.5 100.0 100.5 101.0 101.5 102.0 102.5 103.0 103.5 104.0 10-4.00 10-3.95 10-3.90 10-3.85 10-3.80 10-3.75 10-3.70 10-3.65 10-3.60 10-3.55 10-3.50 10-3.45 10-3.40 10-3.35 10-3.30 10-3.25 10-3.20 10-3.15 10-3.10 10-3.05 10-3.00 10-2.95 10-2.90 10-2.85 10-2.80 10-2.75 10-2.70 10-2.65 10-2.60 10-2.55 10-2.50 10-2.45 10-2.40 10-2.35 10-2.30 10-2.25 10-2.20 10-2.15 10-2.10 10-2.05 10-2.00 10-1.95 10-1.90 10-1.85 10-1.80 10-1.75 10-1.70 10-1.65 10-1.60 10-1.55 10-1.50 10-1.45 10-1.40 10-1.35 10-1.30 10-1.25 10-1.20 10-1.15 10-1.10 10-1.05 10-1.00 10-0.95 10-0.90 10-0.85 10-0.80 10-0.75 10-0.70 10-0.65 10-0.60 10-0.55 10-0.50 10-0.45 10-0.40 10-0.35 10-0.30 10-0.25 10-0.20 10-0.15 10-0.10 10-0.05 100.00 100.05 100.10 100.15 100.20 100.25 100.30 100.35 100.40 100.45 100.50 100.55 100.60 100.65 100.70 100.75 100.80 100.85 100.90 100.95 101.00 101.05 101.10 101.15 101.20 101.25 101.30 101.35 101.40 101.45 101.50 101.55 101.60 101.65 101.70 101.75 101.80 101.85 101.90 101.95 102.00 102.05 102.10 102.15 102.20 102.25 102.30 102.35 102.40 102.45 102.50 102.55 102.60 102.65 102.70 102.75 102.80 102.85 102.90 102.95 103.00 103.05 103.10 103.15 103.20 103.25 103.30 103.35 103.40 103.45 103.50 103.55 103.60 103.65 103.70 103.75 103.80 103.85 103.90 103.95 104.00 10-5 100 105 Arctic fox Owl monkey Mountain beaver Cow Grey wolf Goat Roe deer Guinea pig Verbet Chinchilla Ground squirrel Arctic ground squirrel African giant pouched rat Lesser short-tailed shrew Star-nosed mole Nine-banded armadillo Tree hyrax N.A. opossum Asian elephant Big brown bat Donkey Horse European hedgehog Patas monkey Cat Galago Genet Giraffe Gorilla Grey seal Rock hyrax-a Human African elephant Water opossum Rhesus monkey Kangaroo Yellow-bellied marmot Golden hamster Mouse Little brown bat Slow loris Okapi Rabbit Sheep Jaguar Chimpanzee Baboon Desert hedgehog Giant armadillo Rock hyrax-b Raccoon Rat E. American mole Mole rat Musk shrew Pig Echidna Brazilian tapir Tenrec Phalanger Tree shrew Red fox 0.62685341466672571.7024305364455252 -0.98296666070121960.3979400086720376 0.209515014542630971.0569048513364727 -0.0457574905606751150.414973347970818 2.20411998265592462.2278867046136734 0.477121254719662441.3979400086720377 2.28330122870354972.255272505103306 -1.3187587626244128-0.4814860601221125 -0.91364016932525180.47712125471966244 -1.12493873660830.07918124604762482 -0.55284196865778080.2787536009528289 0.63225477668471361.5932860670204574 0.55630250076728731.3222192947339193 1.77815125038364361.9084850188786497 -0.25963731050575610.38021124171160603 1.02325245963371162.254064452914338 1.71733758272386372.6434526764861874 2.02.1958996524092336 1.74429298312267632.2430380486862944 0.39794000867203761.08278537031645 2.39794000867203752.690196080028514 0.1461280356782381.0969100130080565 -2.0-0.6020599913279624 -1.6382721639824072-0.3979400086720376 -0.92081875395237520.0 0.60745502321466851.2304489213782739 1.54406804435027571.7481880270062005 0.83250891270623632.2528530309798933 0.54406804435027570.5910646070264992 3.82308279653280363.7567881987681178 1.7923916894982543.12057393120585 -0.124938736608299951.089905111439398 1.92941892571429262.5118833609788744 2.3159703454569182.6085260335771943 2.72345567203518572.832508912706236 0.149219112655379881.2430380486862944 -0.69897000433601870.6989700043360189 0.51851393987788741.4082399653118496 1.02.060697840353612 -0.105130343254747450.5440680443502757 2.71683772329952472.816241299991783 2.272073787500012.622214022966295 -1.6382721639824072-0.5228787452803376 3.4060289449636153.663040974893974 0.23044892137827390.7993405494535817 0.30102999566398121.089905111439398 0.54406804435027571.0334237554869496 -1.22184874961635640.0 -2.3010299956639813-0.8538719643217619 0.00.8195439355418687 -0.0362121726544447150.7558748556724915 -0.99567862621735740.6020599913279624 -0.371611069949688460.8061799739838872 0.62221402296629541.7634279935629373 0.017033339298780370.7403626894942439 1.1711411510283821.9921114877869497 1.44185217577329182.060697840353612 1.56026539786271462.0773679052841563 2.6674529528899542.6263403673750423 0.130333768495006140.9084850188786497 -0.31875876262441281.1903316981702914 0.52955867302116311.6483600109809315 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 10-1 100 101 102 103 104 10-1.0 10-0.8 10-0.6 10-0.4 10-0.2 100.0 100.2 100.4 100.6 100.8 101.0 101.2 101.4 101.6 101.8 102.0 102.2 102.4 102.6 102.8 103.0 103.2 103.4 103.6 103.8 104.0 10-1.00 10-0.98 10-0.96 10-0.94 10-0.92 10-0.90 10-0.88 10-0.86 10-0.84 10-0.82 10-0.80 10-0.78 10-0.76 10-0.74 10-0.72 10-0.70 10-0.68 10-0.66 10-0.64 10-0.62 10-0.60 10-0.58 10-0.56 10-0.54 10-0.52 10-0.50 10-0.48 10-0.46 10-0.44 10-0.42 10-0.40 10-0.38 10-0.36 10-0.34 10-0.32 10-0.30 10-0.28 10-0.26 10-0.24 10-0.22 10-0.20 10-0.18 10-0.16 10-0.14 10-0.12 10-0.10 10-0.08 10-0.06 10-0.04 10-0.02 100.00 100.02 100.04 100.06 100.08 100.10 100.12 100.14 100.16 100.18 100.20 100.22 100.24 100.26 100.28 100.30 100.32 100.34 100.36 100.38 100.40 100.42 100.44 100.46 100.48 100.50 100.52 100.54 100.56 100.58 100.60 100.62 100.64 100.66 100.68 100.70 100.72 100.74 100.76 100.78 100.80 100.82 100.84 100.86 100.88 100.90 100.92 100.94 100.96 100.98 101.00 101.02 101.04 101.06 101.08 101.10 101.12 101.14 101.16 101.18 101.20 101.22 101.24 101.26 101.28 101.30 101.32 101.34 101.36 101.38 101.40 101.42 101.44 101.46 101.48 101.50 101.52 101.54 101.56 101.58 101.60 101.62 101.64 101.66 101.68 101.70 101.72 101.74 101.76 101.78 101.80 101.82 101.84 101.86 101.88 101.90 101.92 101.94 101.96 101.98 102.00 102.02 102.04 102.06 102.08 102.10 102.12 102.14 102.16 102.18 102.20 102.22 102.24 102.26 102.28 102.30 102.32 102.34 102.36 102.38 102.40 102.42 102.44 102.46 102.48 102.50 102.52 102.54 102.56 102.58 102.60 102.62 102.64 102.66 102.68 102.70 102.72 102.74 102.76 102.78 102.80 102.82 102.84 102.86 102.88 102.90 102.92 102.94 102.96 102.98 103.00 103.02 103.04 103.06 103.08 103.10 103.12 103.14 103.16 103.18 103.20 103.22 103.24 103.26 103.28 103.30 103.32 103.34 103.36 103.38 103.40 103.42 103.44 103.46 103.48 103.50 103.52 103.54 103.56 103.58 103.60 103.62 103.64 103.66 103.68 103.70 103.72 103.74 103.76 103.78 103.80 103.82 103.84 103.86 103.88 103.90 103.92 103.94 103.96 103.98 104.00 10-2 100 102 104 Brain

The Theme stack

Gadfly maintains a stack of themes and applies theme values from the topmost theme in the stack. This can be useful when you want to set a theme for multiple plots and then switch back to a previous theme.

push_theme(t::Theme) and pop_theme() will push and pop from this stack respectively. You can also use with_theme(f, t::Theme) to temporarily set a theme as the current theme and call function f, which can be defined elsewhere, anonymously, or as a do-block.

For example, here is how to choose a different font:

latex_fonts = Theme(major_label_font="CMU Serif", major_label_font_size=16pt,
                    minor_label_font="CMU Serif", minor_label_font_size=14pt,
                    key_title_font="CMU Serif", key_title_font_size=12pt,
                    key_label_font="CMU Serif", key_label_font_size=10pt)
Gadfly.push_theme(latex_fonts)
gasoline = dataset("Ecdat", "Gasoline")
p = plot(gasoline, x=:Year, y=:LGasPCar, color=:Country, Geom.point, Geom.line)
# can plot more plots here...
Gadfly.pop_theme()
Year 1960 1965 1970 1975 1980 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1960.0 1960.1 1960.2 1960.3 1960.4 1960.5 1960.6 1960.7 1960.8 1960.9 1961.0 1961.1 1961.2 1961.3 1961.4 1961.5 1961.6 1961.7 1961.8 1961.9 1962.0 1962.1 1962.2 1962.3 1962.4 1962.5 1962.6 1962.7 1962.8 1962.9 1963.0 1963.1 1963.2 1963.3 1963.4 1963.5 1963.6 1963.7 1963.8 1963.9 1964.0 1964.1 1964.2 1964.3 1964.4 1964.5 1964.6 1964.7 1964.8 1964.9 1965.0 1965.1 1965.2 1965.3 1965.4 1965.5 1965.6 1965.7 1965.8 1965.9 1966.0 1966.1 1966.2 1966.3 1966.4 1966.5 1966.6 1966.7 1966.8 1966.9 1967.0 1967.1 1967.2 1967.3 1967.4 1967.5 1967.6 1967.7 1967.8 1967.9 1968.0 1968.1 1968.2 1968.3 1968.4 1968.5 1968.6 1968.7 1968.8 1968.9 1969.0 1969.1 1969.2 1969.3 1969.4 1969.5 1969.6 1969.7 1969.8 1969.9 1970.0 1970.1 1970.2 1970.3 1970.4 1970.5 1970.6 1970.7 1970.8 1970.9 1971.0 1971.1 1971.2 1971.3 1971.4 1971.5 1971.6 1971.7 1971.8 1971.9 1972.0 1972.1 1972.2 1972.3 1972.4 1972.5 1972.6 1972.7 1972.8 1972.9 1973.0 1973.1 1973.2 1973.3 1973.4 1973.5 1973.6 1973.7 1973.8 1973.9 1974.0 1974.1 1974.2 1974.3 1974.4 1974.5 1974.6 1974.7 1974.8 1974.9 1975.0 1975.1 1975.2 1975.3 1975.4 1975.5 1975.6 1975.7 1975.8 1975.9 1976.0 1976.1 1976.2 1976.3 1976.4 1976.5 1976.6 1976.7 1976.8 1976.9 1977.0 1977.1 1977.2 1977.3 1977.4 1977.5 1977.6 1977.7 1977.8 1977.9 1978.0 1978.1 1978.2 1978.3 1978.4 1978.5 1978.6 1978.7 1978.8 1978.9 1979.0 1979.1 1979.2 1979.3 1979.4 1979.5 1979.6 1979.7 1979.8 1979.9 1980.0 1960 1980 JAPAN NETHERLA NORWAY SPAIN SWEDEN SWITZERL TURKEY U.K. U.S.A. AUSTRIA BELGIUM CANADA DENMARK FRANCE GERMANY GREECE IRELAND ITALY Country 19784.8184539683 19774.811032467 19764.8148907167 19754.8049322352 19744.7986259444 19734.8463745073 19724.8540732646 19714.8602864749 19704.8484842122 19694.841382713 19684.8341417653 19674.8008834761 19664.8075305603 19654.8059545113 19644.8082735727 19634.7878951522 19624.7989365652 19614.7963170698 19604.8239645123 19784.0003742149 19773.945553345 19763.962305336 19753.9125838579 19743.966961453 19733.995364122 19723.992756786 19713.9836534009 19703.9797051949 19693.948058368 19683.9532027179 19673.9436308491 19663.957212164 19653.968675694 19643.976781186 19633.9852710359 19624.0480509119 19614.0886358 19604.1002442839 19785.1412554768 19775.313462422 19765.312929193 19755.4267771741 19745.42772844 19735.68647036 19725.5788213319 19715.6696463189 19705.72210507 19695.7207051419 19686.0765946269 19676.044478582 19666.156644407 19655.8230458949 19646.064600869 19636.0751291349 19626.0845870211 19616.106212679 19606.1295528491 19784.050047696 19774.100533339 19764.0795721801 19754.120567757 19744.166363739 19734.2298161621 19724.2591593359 19714.280697003 19704.22529671 19694.211290089 19684.2177878429 19674.265918883 19664.2663516041 19654.288713915 19644.3134274369 19634.312484529 19624.2871473959 19614.441329648 19604.397621493 19784.067373445 19774.0310109309 19763.983996505 19753.9738404359 19743.913159154 19734.0305604061 19723.9800657581 19713.982061858 19703.989372472 19693.9917150449 19683.997584757 19673.9973460479 19664.0025573741 19654.015463106 19644.024858515 19634.00276563 19624.0064390159 19614.061869959 19604.063010036 19783.6204438709 19773.6507346971 19763.7108746111 19753.7524488659 19743.768565146 19733.912811545 19723.8912244911 19713.9073442129 19703.96604596 19693.9941031169 19684.0442530621 19674.086322459 19664.113780911 19654.217208979 19644.300577007 19634.346497214 19624.429087629 19614.589239364 19604.7494091723 19784.0024867129 19773.988515537 19763.978209728 19753.9960249669 19743.9603309711 19734.0613489569 19724.077257431 19714.078931746 19704.0888057159 19694.0868228049 19684.103864323 19674.0643140609 19664.0846073869 19654.131633441 19644.164351876 19634.216189342 19624.2342411029 19614.33271925 19604.43504067 19783.8825941949 19773.7766816581 19763.7836345681 19753.718466264 19743.7113837231 19733.8804785129 19723.915296331 19713.9478037431 19703.956407876 19693.987689339 19684.0707346969 19674.119154995 19664.168016513 19654.233001576 19644.31956339 19634.377686978 19624.471717068 19614.559839938 19604.6462680045 19783.9487463871 19773.9646719111 19763.9881620001 19753.995984493 19744.007963901 19734.0938837331 19724.2229757 19714.305623621 19704.401596952 19694.518289907 19684.6846663526 19674.8548612373 19665.0008214407 19655.125850803 19645.275327848 19635.5080817012 19625.6419150489 19615.7584836101 19605.9952865559 19783.3945044428 19773.3802089569 19763.4276288189 19753.5156795149 19743.4994699 19733.6522633939 19723.629243426 19713.6482050719 19703.706871673 19693.737389284 19683.7639029799 19673.7858083619 19663.8227352401 19653.8749851811 19643.936324254 19633.963086271 19624.0289989679 19614.0452481041 19604.050728238 19784.198610729 19774.2415507701 19764.2211462271 19754.248218349 19744.3255853241 19734.253827008 19724.270767878 19714.267117754 19704.2499445181 19694.208612656 19684.18111984 19674.188989564 19664.1682144109 19654.164895673 19644.186242773 19634.176695597 19624.2084346371 19614.2552393669 19604.270420603 19784.546399614 19774.484616757 19764.47995576 19754.580961511 19744.6278067713 19734.7685820877 19724.7957087158 19714.8118147383 19704.8518237449 19694.8947734887 19684.9441602588 19674.9757754289 19665.048395696 19655.0151124361 19645.1786270248 19635.083411848 19625.1880716432 19615.3814948731 19605.0374055349 19783.8838785591 19773.8956900509 19763.8964692669 19753.922028648 19743.8882123569 19733.924155679 19723.9324021681 19713.932104258 19703.9025204189 19693.8991846811 19683.8893615239 19673.875031869 19663.8807406531 19653.861049164 19643.868992975 19633.848782399 19623.8714840411 19613.885345397 19603.916953172 19783.7888825619 19773.812500373 19763.9081160121 19753.8085488721 19743.807994935 19733.8849943329 19723.8466772421 19713.8259622251 19703.801582653 19693.773460001 19683.7782304139 19673.7686207529 19663.7495348571 19653.760583648 19643.7670843699 19633.788996565 19623.823666088 19613.8856225131 19603.9077042329 19784.0366010839 19774.005290418 19764.0077389471 19754.0330145629 19744.000460803 19734.137437795 19724.082807844 19714.1031462929 19704.128807176 19694.173561413 19684.161687403 19674.2034662751 19664.2336434839 19654.249453555 19644.326435619 19634.3539971901 19624.385448561 19614.4828459381 19604.50198595 19784.855845841 19774.810991519 19764.8373587579 19754.888471343 19744.8915906557 19734.89969379 19724.8893020193 19714.8950745608 19704.8995700246 19694.8644326333 19684.868782423 19674.8524989572 19664.871024855 19654.850827846 19644.8397604783 19634.8380800488 19624.8505325093 19614.8265553731 19604.8552384411 19783.842741783 19773.854311239 19763.8641455001 19753.877778414 19743.8182304581 19733.8959956699 19723.905401926 19713.8722450341 19703.870391622 19693.8546012139 19683.8286653779 19673.9068782151 19663.8205378359 19653.9515307039 19643.994375414 19634.001266072 19624.075961692 19614.124355641 19604.16401597 19783.922749583 19773.9316759431 19763.985411744 19754.0290180751 19744.018495372 19734.199380561 19724.128017777 19714.106720494 19704.0808876731 19694.0463547891 19684.045507048 19674.0529106939 19664.0475365589 19654.033983285 19644.037688787 19634.0595091239 19624.0731765511 19614.1009891049 19604.173244195 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 3 4 5 6 7 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 2.98 3.00 3.02 3.04 3.06 3.08 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 6.02 6.04 6.06 6.08 6.10 6.12 6.14 6.16 6.18 6.20 6.22 6.24 6.26 6.28 6.30 6.32 6.34 6.36 6.38 6.40 6.42 6.44 6.46 6.48 6.50 6.52 6.54 6.56 6.58 6.60 6.62 6.64 6.66 6.68 6.70 6.72 6.74 6.76 6.78 6.80 6.82 6.84 6.86 6.88 6.90 6.92 6.94 6.96 6.98 7.00 3 4 5 6 7 LGasPCar

The same effect can be achieved using with_theme:

Gadfly.with_theme(latex_fonts) do
    gasoline = dataset("Ecdat", "Gasoline")
    plot(gasoline, x=:Year, y=:LGasPCar, color=:Country, Geom.point, Geom.line)
end

style

You can use style to override the fields of the current theme. Much like Theme's constructor, style inputs keyword arguments, returns a Theme, and can be used with push_theme, with_theme, and plot.

Gadfly.push_theme(style(line_width=1mm))
p1 = plot([sin,cos], 0, 2pi)
p2 = plot([sin,cos], 0, 2pi, style(line_width=2mm, line_style=[:dash]))
fig = hstack(p1,p2)
Gadfly.pop_theme()
x 0 2 4 6 8 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00 4.05 4.10 4.15 4.20 4.25 4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 4.75 4.80 4.85 4.90 4.95 5.00 5.05 5.10 5.15 5.20 5.25 5.30 5.35 5.40 5.45 5.50 5.55 5.60 5.65 5.70 5.75 5.80 5.85 5.90 5.95 6.00 6.05 6.10 6.15 6.20 6.25 6.30 6.35 6.40 6.45 6.50 6.55 6.60 6.65 6.70 6.75 6.80 6.85 6.90 6.95 7.00 7.05 7.10 7.15 7.20 7.25 7.30 7.35 7.40 7.45 7.50 7.55 7.60 7.65 7.70 7.75 7.80 7.85 7.90 7.95 8.00 0 10 f1 f2 Color h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -1.0 -0.5 0.0 0.5 1.0 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 -1.00 -0.99 -0.98 -0.97 -0.96 -0.95 -0.94 -0.93 -0.92 -0.91 -0.90 -0.89 -0.88 -0.87 -0.86 -0.85 -0.84 -0.83 -0.82 -0.81 -0.80 -0.79 -0.78 -0.77 -0.76 -0.75 -0.74 -0.73 -0.72 -0.71 -0.70 -0.69 -0.68 -0.67 -0.66 -0.65 -0.64 -0.63 -0.62 -0.61 -0.60 -0.59 -0.58 -0.57 -0.56 -0.55 -0.54 -0.53 -0.52 -0.51 -0.50 -0.49 -0.48 -0.47 -0.46 -0.45 -0.44 -0.43 -0.42 -0.41 -0.40 -0.39 -0.38 -0.37 -0.36 -0.35 -0.34 -0.33 -0.32 -0.31 -0.30 -0.29 -0.28 -0.27 -0.26 -0.25 -0.24 -0.23 -0.22 -0.21 -0.20 -0.19 -0.18 -0.17 -0.16 -0.15 -0.14 -0.13 -0.12 -0.11 -0.10 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00 -1 0 1 f(x) x 0 2 4 6 8 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95 4.00 4.05 4.10 4.15 4.20 4.25 4.30 4.35 4.40 4.45 4.50 4.55 4.60 4.65 4.70 4.75 4.80 4.85 4.90 4.95 5.00 5.05 5.10 5.15 5.20 5.25 5.30 5.35 5.40 5.45 5.50 5.55 5.60 5.65 5.70 5.75 5.80 5.85 5.90 5.95 6.00 6.05 6.10 6.15 6.20 6.25 6.30 6.35 6.40 6.45 6.50 6.55 6.60 6.65 6.70 6.75 6.80 6.85 6.90 6.95 7.00 7.05 7.10 7.15 7.20 7.25 7.30 7.35 7.40 7.45 7.50 7.55 7.60 7.65 7.70 7.75 7.80 7.85 7.90 7.95 8.00 0 10 f1 f2 Color h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -1.0 -0.5 0.0 0.5 1.0 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 -1.00 -0.99 -0.98 -0.97 -0.96 -0.95 -0.94 -0.93 -0.92 -0.91 -0.90 -0.89 -0.88 -0.87 -0.86 -0.85 -0.84 -0.83 -0.82 -0.81 -0.80 -0.79 -0.78 -0.77 -0.76 -0.75 -0.74 -0.73 -0.72 -0.71 -0.70 -0.69 -0.68 -0.67 -0.66 -0.65 -0.64 -0.63 -0.62 -0.61 -0.60 -0.59 -0.58 -0.57 -0.56 -0.55 -0.54 -0.53 -0.52 -0.51 -0.50 -0.49 -0.48 -0.47 -0.46 -0.45 -0.44 -0.43 -0.42 -0.41 -0.40 -0.39 -0.38 -0.37 -0.36 -0.35 -0.34 -0.33 -0.32 -0.31 -0.30 -0.29 -0.28 -0.27 -0.26 -0.25 -0.24 -0.23 -0.22 -0.21 -0.20 -0.19 -0.18 -0.17 -0.16 -0.15 -0.14 -0.13 -0.12 -0.11 -0.10 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.00 -1 0 1 f(x)

Named themes

To register a theme by name, you can extend Gadfly.get_theme(::Val{:theme_name}) to return a Theme object.

Gadfly.get_theme(::Val{:orange}) = Theme(default_color="orange")

Gadfly.with_theme(:orange) do
    plot(dataset("datasets", "iris"), x=:SepalWidth, Geom.bar)
end
SepalWidth 1 2 3 4 5 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80 0.82 0.84 0.86 0.88 0.90 0.92 0.94 0.96 0.98 1.00 1.02 1.04 1.06 1.08 1.10 1.12 1.14 1.16 1.18 1.20 1.22 1.24 1.26 1.28 1.30 1.32 1.34 1.36 1.38 1.40 1.42 1.44 1.46 1.48 1.50 1.52 1.54 1.56 1.58 1.60 1.62 1.64 1.66 1.68 1.70 1.72 1.74 1.76 1.78 1.80 1.82 1.84 1.86 1.88 1.90 1.92 1.94 1.96 1.98 2.00 2.02 2.04 2.06 2.08 2.10 2.12 2.14 2.16 2.18 2.20 2.22 2.24 2.26 2.28 2.30 2.32 2.34 2.36 2.38 2.40 2.42 2.44 2.46 2.48 2.50 2.52 2.54 2.56 2.58 2.60 2.62 2.64 2.66 2.68 2.70 2.72 2.74 2.76 2.78 2.80 2.82 2.84 2.86 2.88 2.90 2.92 2.94 2.96 2.98 3.00 3.02 3.04 3.06 3.08 3.10 3.12 3.14 3.16 3.18 3.20 3.22 3.24 3.26 3.28 3.30 3.32 3.34 3.36 3.38 3.40 3.42 3.44 3.46 3.48 3.50 3.52 3.54 3.56 3.58 3.60 3.62 3.64 3.66 3.68 3.70 3.72 3.74 3.76 3.78 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 0 5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 0 50 100 150 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 20.5 21.0 21.5 22.0 22.5 23.0 23.5 24.0 24.5 25.0 25.5 26.0 26.5 27.0 27.5 28.0 28.5 29.0 29.5 30.0 30.5 31.0 31.5 32.0 32.5 33.0 33.5 34.0 34.5 35.0 35.5 36.0 36.5 37.0 37.5 38.0 38.5 39.0 39.5 40.0 40.5 41.0 41.5 42.0 42.5 43.0 43.5 44.0 44.5 45.0 45.5 46.0 46.5 47.0 47.5 48.0 48.5 49.0 49.5 50.0 50.5 51.0 51.5 52.0 52.5 53.0 53.5 54.0 54.5 55.0 55.5 56.0 56.5 57.0 57.5 58.0 58.5 59.0 59.5 60.0 60.5 61.0 61.5 62.0 62.5 63.0 63.5 64.0 64.5 65.0 65.5 66.0 66.5 67.0 67.5 68.0 68.5 69.0 69.5 70.0 70.5 71.0 71.5 72.0 72.5 73.0 73.5 74.0 74.5 75.0 75.5 76.0 76.5 77.0 77.5 78.0 78.5 79.0 79.5 80.0 80.5 81.0 81.5 82.0 82.5 83.0 83.5 84.0 84.5 85.0 85.5 86.0 86.5 87.0 87.5 88.0 88.5 89.0 89.5 90.0 90.5 91.0 91.5 92.0 92.5 93.0 93.5 94.0 94.5 95.0 95.5 96.0 96.5 97.0 97.5 98.0 98.5 99.0 99.5 100.0 100.5 101.0 101.5 102.0 102.5 103.0 103.5 104.0 104.5 105.0 105.5 106.0 106.5 107.0 107.5 108.0 108.5 109.0 109.5 110.0 110.5 111.0 111.5 112.0 112.5 113.0 113.5 114.0 114.5 115.0 115.5 116.0 116.5 117.0 117.5 118.0 118.5 119.0 119.5 120.0 120.5 121.0 121.5 122.0 122.5 123.0 123.5 124.0 124.5 125.0 125.5 126.0 126.5 127.0 127.5 128.0 128.5 129.0 129.5 130.0 130.5 131.0 131.5 132.0 132.5 133.0 133.5 134.0 134.5 135.0 135.5 136.0 136.5 137.0 137.5 138.0 138.5 139.0 139.5 140.0 140.5 141.0 141.5 142.0 142.5 143.0 143.5 144.0 144.5 145.0 145.5 146.0 146.5 147.0 147.5 148.0 148.5 149.0 149.5 150.0 0 200

Gadfly comes built in with two named themes: :default and :dark.

Gadfly.with_theme(:dark) do
    plot(dataset("datasets", "iris"), x=:SepalLength, y=:SepalWidth, color=:Species)
end
SepalLength 4 5 6 7 8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 5.8 6.0 6.2 6.4 6.6 6.8 7.0 7.2 7.4 7.6 7.8 8.0 3.98 4.00 4.02 4.04 4.06 4.08 4.10 4.12 4.14 4.16 4.18 4.20 4.22 4.24 4.26 4.28 4.30 4.32 4.34 4.36 4.38 4.40 4.42 4.44 4.46 4.48 4.50 4.52 4.54 4.56 4.58 4.60 4.62 4.64 4.66 4.68 4.70 4.72 4.74 4.76 4.78 4.80 4.82 4.84 4.86 4.88 4.90 4.92 4.94 4.96 4.98 5.00 5.02 5.04 5.06 5.08 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.24 5.26 5.28 5.30 5.32 5.34 5.36 5.38 5.40 5.42 5.44 5.46 5.48 5.50 5.52 5.54 5.56 5.58 5.60 5.62 5.64 5.66 5.68 5.70 5.72 5.74 5.76 5.78 5.80 5.82 5.84 5.86 5.88 5.90 5.92 5.94 5.96 5.98 6.00 6.02 6.04 6.06 6.08 6.10 6.12 6.14 6.16 6.18 6.20 6.22 6.24 6.26 6.28 6.30 6.32 6.34 6.36 6.38 6.40 6.42 6.44 6.46 6.48 6.50 6.52 6.54 6.56 6.58 6.60 6.62 6.64 6.66 6.68 6.70 6.72 6.74 6.76 6.78 6.80 6.82 6.84 6.86 6.88 6.90 6.92 6.94 6.96 6.98 7.00 7.02 7.04 7.06 7.08 7.10 7.12 7.14 7.16 7.18 7.20 7.22 7.24 7.26 7.28 7.30 7.32 7.34 7.36 7.38 7.40 7.42 7.44 7.46 7.48 7.50 7.52 7.54 7.56 7.58 7.60 7.62 7.64 7.66 7.68 7.70 7.72 7.74 7.76 7.78 7.80 7.82 7.84 7.86 7.88 7.90 7.92 7.94 7.96 7.98 8.00 4 6 8 setosa versicolor virginica Species 5.9,3.0 6.2,3.4 6.5,3.0 6.3,2.5 6.7,3.0 6.7,3.3 6.8,3.2 5.8,2.7 6.9,3.1 6.7,3.1 6.9,3.1 6.0,3.0 6.4,3.1 6.3,3.4 7.7,3.0 6.1,2.6 6.3,2.8 6.4,2.8 7.9,3.8 7.4,2.8 7.2,3.0 6.4,2.8 6.1,3.0 6.2,2.8 7.2,3.2 6.7,3.3 6.3,2.7 7.7,2.8 5.6,2.8 6.9,3.2 6.0,2.2 7.7,2.6 7.7,3.8 6.5,3.0 6.4,3.2 5.8,2.8 5.7,2.5 6.8,3.0 6.4,2.7 6.5,3.2 7.2,3.6 6.7,2.5 7.3,2.9 4.9,2.5 7.6,3.0 6.5,3.0 6.3,2.9 7.1,3.0 5.8,2.7 6.3,3.3 5.7,2.8 5.1,2.5 6.2,2.9 5.7,2.9 5.7,3.0 5.6,2.7 5.0,2.3 5.8,2.6 6.1,3.0 5.5,2.6 5.5,2.5 5.6,3.0 6.3,2.3 6.7,3.1 6.0,3.4 5.4,3.0 6.0,2.7 5.8,2.7 5.5,2.4 5.5,2.4 5.7,2.6 6.0,2.9 6.7,3.0 6.8,2.8 6.6,3.0 6.4,2.9 6.1,2.8 6.3,2.5 6.1,2.8 5.9,3.2 5.6,2.5 6.2,2.2 5.8,2.7 5.6,3.0 6.7,3.1 5.6,2.9 6.1,2.9 6.0,2.2 5.9,3.0 5.0,2.0 5.2,2.7 6.6,2.9 4.9,2.4 6.3,3.3 5.7,2.8 6.5,2.8 5.5,2.3 6.9,3.1 6.4,3.2 7.0,3.2 5.0,3.3 5.3,3.7 4.6,3.2 5.1,3.8 4.8,3.0 5.1,3.8 5.0,3.5 4.4,3.2 4.5,2.3 5.0,3.5 5.1,3.4 4.4,3.0 4.9,3.6 5.5,3.5 5.0,3.2 4.9,3.1 5.5,4.2 5.2,4.1 5.4,3.4 4.8,3.1 4.7,3.2 5.2,3.4 5.2,3.5 5.0,3.4 5.0,3.0 4.8,3.4 5.1,3.3 4.6,3.6 5.1,3.7 5.4,3.4 5.1,3.8 5.7,3.8 5.1,3.5 5.4,3.9 5.7,4.4 5.8,4.0 4.3,3.0 4.8,3.0 4.8,3.4 5.4,3.7 4.9,3.1 4.4,2.9 5.0,3.4 4.6,3.4 5.4,3.9 5.0,3.6 4.6,3.1 4.7,3.2 4.9,3.0 5.1,3.5 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? 2.0 2.5 3.0 3.5 4.0 4.5 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 1.99 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.35 2.36 2.37 2.38 2.39 2.40 2.41 2.42 2.43 2.44 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 2.66 2.67 2.68 2.69 2.70 2.71 2.72 2.73 2.74 2.75 2.76 2.77 2.78 2.79 2.80 2.81 2.82 2.83 2.84 2.85 2.86 2.87 2.88 2.89 2.90 2.91 2.92 2.93 2.94 2.95 2.96 2.97 2.98 2.99 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 3.35 3.36 3.37 3.38 3.39 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60 3.61 3.62 3.63 3.64 3.65 3.66 3.67 3.68 3.69 3.70 3.71 3.72 3.73 3.74 3.75 3.76 3.77 3.78 3.79 3.80 3.81 3.82 3.83 3.84 3.85 3.86 3.87 3.88 3.89 3.90 3.91 3.92 3.93 3.94 3.95 3.96 3.97 3.98 3.99 4.00 4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.40 4.41 4.42 4.43 4.44 4.45 4.46 4.47 4.48 4.49 4.50 2 3 4 5 SepalWidth

You can also set a theme to use by default by setting the GADFLY_THEME environment variable before loading Gadfly.