Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
with
Mathematica
March 8, 2010
Edward Bujak
Edward_Bujak@hotmail.com
Goals :
To explore and dynamically interact easily with large real-time data sets visually, graphically, algebraically.
Manipulate data and its creative presentation to maximize information transfer utilizing numeric, textual, and/or image representa-
tions.
2 Methods :
Import[ ] function allows us to process data from personal files.
<Name>Data[ ] functions allow us to manipulate large amounts of real-world data into Mathematica from Wolfram's Integrated
Data Sources (Curated Data Sources).
Notes :
With data we have values, not functions. So the data is discrete, not continuous.
In Mathematica the data can be anything, not just numbers.
2 Data Visualization with Mathematica.03.nb
Mathematica
Deployment options:
1. Notebook Player - I can share this interactivity with anyone who does not have Mathematica. User needs to download the
free Mathematica Player - www.wolfram.com/products/player. The author needs to publish the notebook (.NB) into a notebook
player (.NBP) file with Wolfram Mathematica Player: Online Conversion - www.wolfram.com/solutions/interactivedeployment/publish
2. Slideshow generator via "Slide Show palette" - dynamic, live - need the free Notebook Player if you do not have Mathemat-
ica.
3. “Demonstration” - dynamic interactivity with Manipulate[] to create virtual manipulatives that can be hosted at Wolfram's
Demonstrations site - http://demonstrations.wolfram.com
4. Can save almost anything (including cell, selections) as static RTF, PDF, HTML, TeX, TXT, PS, XML, package, GIF, JPG,
PNG, TIFF, BMP, WMF, LATE X, MathML
5. Quiz generator.
Mathematica Syntax
Mathematica is symbolic. As in all CAS (Computer Algebrais Systems], the presentation of the mathematical results may some-
times look non "traditional." Sometimes may want TraditionalForm[] or set a system preference to always display tradtional form..
[ ] ® function
{ } ® lists and sets
( ) ® grouping
[[ ]] ® indexing
= ® assignment
== ® logical equal
:= ® function definition
? Table
1 2 7 2
2 4 9 32
3 6 11 162
4 8 13 512
5 10 15 1250
6 12 17 2592
Looking at some visualization capbabilities. Remember that data is discrete so the Mathematica functions that utilize a mathemati-
cal function can only be used after the data is modeled with a function.
sizeImageNotebook 200;
1.0
0.5
1 2 3 4 5 6
-0.5
-1.0
4 Data Visualization with Mathematica.03.nb
1.0
0.5
2
0.0
-0.5 1
-1.0
0
-2
0 -1
2 -2
-1
-2
-3 -2 -1 0 1 2 3
200
150
100
50
10 20 30 40 50
Everything can be changed, decorated, annotated via options (PlotStyle is a graphic option) and directives. This can be easily
accessed from the "Chart Element Schemes" and the "Color Schemes"palettes.
Hover cursor over any point to be shown the data value in the tooltip.
Data Visualization with Mathematica.03.nb 5
5.0
4.5
4.0
3.5
5.0
4.5
4.0
3.5
Showdata1, data2
5.0
4.5
4.0
3.5
15
10
-cos sin
1 0
Π Π
-cos
7 7
3Π 3Π
sin
14 14
Π Π
-sin cos
-cos
14 14
Π Π
-sin
14 14
3Π 3Π
sin cos
-cos -sin
14 14
Π Π
7 7
1 0
NstarData
1. 0.
-0.900969 0.433884
0.62349 -0.781831
-0.222521 0.974928
-0.222521 -0.974928
0.62349 0.781831
-0.900969 -0.433884
1. 0.
1.0
0.5
0.0
-0.5
-1.0
-0.5 0.0 0.5 1.0
Data Visualization with Mathematica.03.nb 7
1.0
1.0
0.5
0.0
0.0 0.5
0.5
0.0
1.0
sinΠ2
Π2 4 Π2 9 Π2 16 Π2
0 sin sin sin sin
25 25 25 25
sin + Π2
5 5 Π Π2 Π 4 Π2 Π 9 Π2 Π 16 Π2 Π
- sin + sin + sin + sin +
8 8 5 25 5 25 5 25 5 25 5
sin - Π2
5 5 Π Π2 Π 4 Π2 Π 9 Π2 Π 16 Π2 Π
- sin - sin - sin - sin -
8 8 5 25 5 25 5 25 5 25 5
-sinΠ2
Π2 4 Π2 9 Π2 16 Π2
0 -sin -sin -sin -sin
25 25 25 25
1.0
0.5
6
0.0
-0.5
-1.0 4
2
4 2
6
8 Data Visualization with Mathematica.03.nb
1.0
0.5
-0.5
-1.0
-2
-4
-6 -4 -2 0 2
Data Visualization with Mathematica.03.nb 9
ParametricPlot3D
t ,
Cost Sint t
, t ,
t, 6 , 6 ,
10 10 10
ImageSize sizeImageNotebook,
PlotStyle Thick, Red
1
0
-1
-1
-1
0
1
1.0
0.5
-0.5 0.5
-0.5
10 Data Visualization with Mathematica.03.nb
Layered graphs.
LayeredGraphPlot1 2, 1 3, 2 3, 1 4, 2 4, 1 5,
VertexLabeling True, ImageSize sizeImageNotebook
5 2
3 4
12 Data Visualization with Mathematica.03.nb
tiger deer
cow
Import and Export can handle not only tabular data, but also data corresponding to graphics, sounds, expressions and even
whole documents. Import and Export can often deduce the appropriate format for data simply by looking at the extension of the
file name for the file in which the data is being stored. "Exporting Graphics and Sounds" and "Importing and Exporting Files" discuss
in more detail how Import and Export work. Note that you can also use Import and Export to manipulate raw files of binary
data.
Data Visualization with Mathematica.03.nb 13
$ImportFormats
3DS, ACO, AIFF, ApacheLog, AU, AVI, Base64, Binary, Bit, BMP, Byte, BYU, BZIP2, CDED, CDF, Character16, Character8,
Complex128, Complex256, Complex64, CSV, CUR, DBF, DICOM, DIF, Directory, DXF, EDF, ExpressionML, FASTA, FITS,
FLAC, GenBank, GeoTIFF, GIF, Graph6, GTOPO30, GZIP, HarwellBoeing, HDF, HDF5, HTML, ICO, Integer128, Integer16,
Integer24, Integer32, Integer64, Integer8, JPEG, JPEG2000, JVX, LaTeX, List, LWO, MAT, MathML, MBOX, MDB, MGF,
MMCIF, MOL, MOL2, MPS, MTP, MTX, MX, NB, NetCDF, NOFF, OBJ, ODS, OFF, Package, PBM, PCX, PDB, PDF,
PGM, PLY, PNG, PNM, PPM, PXR, QuickTime, RawBitmap, Real128, Real32, Real64, RIB, RSS, RTF, SCT, SDF, SDTS,
SDTSDEM, SHP, SMILES, SND, SP3, Sparse6, STL, String, SXC, Table, TAR, TerminatedString, Text, TGA, TIFF, TIGER,
TSV, UnsignedInteger128, UnsignedInteger16, UnsignedInteger24, UnsignedInteger32, UnsignedInteger64, UnsignedInteger8,
USGSDEM, UUE, VCF, WAV, Wave64, WDX, XBM, XHTML, XHTMLMathML, XLS, XML, XPORT, XYZ, ZIP
$ExportFormats
3DS, ACO, AIFF, AU, AVI, Base64, Binary, Bit, BMP, Byte, BYU, BZIP2, CDF, Character16, Character8, Complex128,
Complex256, Complex64, CSV, DICOM, DIF, DXF, EMF, EPS, ExpressionML, FASTA, FITS, FLAC, FLV, GIF, Graph6,
GZIP, HarwellBoeing, HDF, HDF5, HTML, Integer128, Integer16, Integer24, Integer32, Integer64, Integer8, JPEG,
JPEG2000, JVX, List, LWO, MAT, MathML, Maya, MGF, MIDI, MOL, MOL2, MTX, MX, NB, NetCDF, NOFF, OBJ,
OFF, Package, PBM, PCX, PDB, PDF, PGM, PLY, PNG, PNM, POV, PPM, PXR, RawBitmap, Real128, Real32, Real64,
RIB, RTF, SCT, SDF, SND, Sparse6, STL, String, SVG, SWF, Table, TAR, TerminatedString, TeX, Text, TGA, TIFF, TSV,
UnsignedInteger128, UnsignedInteger16, UnsignedInteger24, UnsignedInteger32, UnsignedInteger64, UnsignedInteger8,
UUE, VRML, WAV, Wave64, WDX, WMF, X3D, XBM, XHTML, XHTMLMathML, XLS, XML, XYZ, ZIP, ZPR
? Import
Import" file" imports data from a file, returning a complete Mathematica version of it.
Import" file", elements imports the specified elements from a file.
Import"http:url", … and Import"ftp:url", … imports from any accessible URL.
? Fit
? FindFit
best fit to data as a function of vars. The data can have the form x1 , y1 , …, f1 , x2 , y2 , …, f2 , …,
FindFitdata, expr, pars, vars finds numerical values of the parameters pars that make expr give a
data can also be of the form f1 , f2 , …, with a single coordinate assumed to take values 1, 2, ….
where the number of coordinates x, y, … is equal to the number of variables in the list vars. The
FindFitdata, expr, cons, pars, vars finds a best fit subject to the parameter constraints cons.
$DataDirectory
AppendTo$Path, $DataDirectory;
$Path
50
40
30
2 4 6 8 10
a ® 4.61415, b ® 8.924
50
40
30
2 4 6 8 10
1.0
0.5
1 2 3 4 5 6
-0.5
-1.0
1.0
0.5
1 2 3 4 5 6
-0.5
-1.0
dataPulsar
0.687021 -0.0188495
0.719811 -0.335115
0.730804 -0.52507
0.796315 0.257191
0.845486 2.15298
0.861925 2.10726
0.952068 -2.59551
0.95484 -2.62171
0.973977 -2.32315
0.976714 -2.22064
1.20073 -0.568935
1.21987 -0.150349
Data Visualization with Mathematica.03.nb 17
1.21987 -0.150349
1.30188 -0.488403
1.30455 -0.494481
1.31002 -0.469674
1.39201 1.94947
1.39477 1.97185
1.44655 0.0107999
1.44664 0.0066815
1.55317 -0.0770058
1.55587 0.128978
1.59684 2.46479
1.59966 2.52511
1.63513 1.86379
1.67874 -0.689795
1.68151 -0.815304
1.6897 -1.12602
1.70062 -1.37461
1.71974 -1.37764
1.76346 -0.223993
1.76619 -0.155781
1.80171 0.231833
1.80456 0.218089
1.80735 0.19759
1.82358 0.02412
1.82634 -0.0089064
1.8509 -0.22583
1.85364 -0.222086
1.86456 -0.150962
1.88094 0.176626
1.88366 0.253788
1.90829 1.07285
1.91101 1.16397
1.91379 1.24854
1.91918 1.40647
1.92192 1.46948
1.96838 1.15017
1.99029 -0.019696
2.06935 -1.89477
2.12112 1.7299
2.13467 2.39416
2.15652 2.67063
2.15925 2.63692
2.18661 1.47038
2.19189 1.12811
2.19464 0.939938
2.26282 -1.63623
2.29831 -0.571845
18 Data Visualization with Mathematica.03.nb
2.29831 -0.571845
2.30105 -0.467178
2.3038 -0.370373
2.30653 -0.27104
2.30923 -0.185139
2.31196 -0.100059
2.31473 -0.0191635
2.31741 0.0613637
2.32012 0.135984
2.32288 0.193437
2.32562 0.262972
2.33105 0.3573
2.3336 0.386537
2.38549 0.108196
2.3882 0.0782136
2.41802 0.0979297
2.41909 0.116686
2.4208 0.139112
2.49979 1.2944
2.50256 1.23173
2.55708 -1.44589
2.55979 -1.58387
2.57344 -2.143
2.57619 -2.21118
2.66331 1.77407
2.66602 1.93837
2.72048 2.01038
2.7232 1.85777
2.75059 -0.0428941
2.75592 -0.405188
2.75867 -0.595059
2.78859 -1.85679
2.79134 -1.89844
2.83763 -0.804781
2.84038 -0.68503
2.87312 0.49313
2.87584 0.550665
2.91669 0.564317
2.96028 0.154039
2.96302 0.17036
3.02575 1.16419
3.02851 1.17307
3.08589 -0.619972
3.08867 -0.764877
3.12139 -2.11591
3.1706 -0.76415
3.17332 -0.576337
Data Visualization with Mathematica.03.nb 19
3.23625 2.80614
3.2389 2.80191
3.26894 1.70996
3.2717 1.52628
3.27441 1.34718
3.27716 1.15426
3.27988 0.958417
3.2826 0.752647
3.28539 0.542753
3.28809 0.337932
3.29353 -0.0750401
3.29624 -0.274558
3.299 -0.47054
3.30172 -0.667524
3.30445 -0.851145
3.30719 -1.02325
3.31267 -1.34591
3.3154 -1.48888
3.31809 -1.61345
3.32085 -1.73499
3.3263 -1.91916
3.32906 -1.9923
3.33182 -2.04945
3.33455 -2.09106
3.38369 -0.774774
3.38643 -0.647009
3.43013 0.938914
3.4312 0.951182
3.43291 0.967501
3.47933 0.531234
3.48206 0.479443
3.52028 0.222164
3.54214 0.516191
3.54486 0.560826
3.55033 0.649746
3.55852 0.771456
3.56671 0.857604
3.56947 0.87025
3.57219 0.882395
3.57496 0.889598
3.58044 0.873126
3.58584 0.832191
3.5886 0.800181
3.5914 0.757595
3.59404 0.708435
3.59676 0.654172
3.59952 0.585253
20 Data Visualization with Mathematica.03.nb
3.59952 0.585253
3.60227 0.513836
3.60496 0.43218
3.60775 0.345518
3.6241 -0.303461
3.62692 -0.430591
3.63231 -0.679269
3.63502 -0.809463
3.63778 -0.929009
3.64049 -1.05495
3.64323 -1.18237
3.64596 -1.30095
3.65144 -1.5187
3.65414 -1.6279
3.65689 -1.70974
3.65962 -1.79757
3.66236 -1.87084
3.6651 -1.93
3.71426 -0.703003
3.71701 -0.515862
3.76086 2.36768
3.76342 2.46275
dataPulsarPlot
1
ListPlotdataPulsar, AspectRatio , PlotStyle Red
2
3
-2
This computes the regression using nondefault starting values for the parameters.
params FindFitdataPulsar,
Sin t Cos t Sin t Cos t ,
, 1, , 1, , 1, , 0, , 23.31, , 34.64, , 0, t
-1
-2
xxxxData[] - Curated Data Sources - Integrated Data Sources - What Kind of Data Collections?
xxxxData functions :
An efficient load-on-demand mechanism makes hundreds of gigabytes of carefully curated and continually updated data immedi-
ately available inside Mathematica for use in computations. This data, curated at Wolfram Research, can be accessed and pro-
cessed in a coherent way.
Examples include:
LatticeData,
WeatherData,
Physical and chemical data: ElementData, ChemicalData, IsotopeData, ParticleData, »
Earth and astronomical data: WeatherData, GeodesyData, CityData, CountryData, GeoDistance, AstronomicalData, »
Life science data: GenomeData, GenomeLookup, SequenceAlignment, ProteinData, »
Finance and economic data: FinancialData, CountryData, »
Mathematical data: FiniteGroupData, GraphData, KnotData, LatticeData, PolyhedronData, »
Linguistic data: DictionaryLookup, WordData, ExampleData, »
ProteinData" prot" gives the reference amino acid sequence for the protein prot.
ProteinData" prot", " property" gives the value of the specified property for the protein prot.
22 Data Visualization with Mathematica.03.nb
? ElementData
ElementData"name", " property" gives the value of the specified property for the chemical element "name".
ElementDatan, " property" gives the specified property for the nth chemical element.
ElementData
Hydrogen, Helium, Lithium, Beryllium, Boron, Carbon, Nitrogen, Oxygen, Fluorine, Neon, Sodium, Magnesium, Aluminum, Silicon,
Phosphorus, Sulfur, Chlorine, Argon, Potassium, Calcium, Scandium, Titanium, Vanadium, Chromium, Manganese, Iron,
Cobalt, Nickel, Copper, Zinc, Gallium, Germanium, Arsenic, Selenium, Bromine, Krypton, Rubidium, Strontium, Yttrium,
Zirconium, Niobium, Molybdenum, Technetium, Ruthenium, Rhodium, Palladium, Silver, Cadmium, Indium, Tin, Antimony,
Tellurium, Iodine, Xenon, Cesium, Barium, Lanthanum, Cerium, Praseodymium, Neodymium, Promethium, Samarium,
Europium, Gadolinium, Terbium, Dysprosium, Holmium, Erbium, Thulium, Ytterbium, Lutetium, Hafnium, Tantalum, Tungsten,
Rhenium, Osmium, Iridium, Platinum, Gold, Mercury, Thallium, Lead, Bismuth, Polonium, Astatine, Radon, Francium, Radium,
Actinium, Thorium, Protactinium, Uranium, Neptunium, Plutonium, Americium, Curium, Berkelium, Californium, Einsteinium,
Fermium, Mendelevium, Nobelium, Lawrencium, Rutherfordium, Dubnium, Seaborgium, Bohrium, Hassium, Meitnerium,
Darmstadtium, Roentgenium, Ununbium, Ununtrium, Ununquadium, Ununpentium, Ununhexium, Ununseptium, Ununoctium
ElementData1
Hydrogen
LengthElementData
118
ElementData"Properties"
ElementData"Hydrogen", "MeltingPoint"
-259.14
ElementData1, "MeltingPoint"
-259.14
ElementData"H", "MeltingPoint"
-259.14
DegreesCelsius
°C
? ListLinePlot
-259.14, —, 180.54, 1287., 2075., 3550., -210.1, -218.3, -219.6, -248.59, 97.72, 650., 660.32, 1414., 44.2, 115.21, -101.5, -189.3,
63.38, 842., 1541., 1668., 1910., 1907., 1246., 1538., 1495., 1455., 1084.62, 419.53, 29.76, 938.3, 817., 221., -7.3, -157.36,
39.31, 777., 1526., 1855., 2477., 2623., 2157., 2334., 1964., 1554.9, 961.78, 321.07, 156.6, 231.93, 630.63, 449.51, 113.7, -111.8,
28.44, 727., 920., 798., 931., 1021., 1.1 ´ 103 , 1072., 822., 1313., 1356., 1412., 1474., 1497., 1545., 819., 1663., 2233., 3017.,
3422., 3186., 3033., 2466., 1768.3, 1064.18, -38.83, 304., 327.46, 271.3, 254., 302., -71., —, 7.0 ´ 102 , 1050., 1750., 1572.,
1135., 644., 640., 1176., 1345., 1050., 900., 860., 1527., 827., 827., 1627., —, —, —, —, —, —, —, —, —, —, —, —, —, —, —
24 Data Visualization with Mathematica.03.nb
3500
3000
2500
2000
1500
1000
500
20 40 60 80 100
? ListPlot
ListPlotx1 , y1 , x2 , y2 , … plots a list of points with specified x and y coordinates.
ListPloty1 , y2 , … plots points corresponding to a list of values, assumed to correspond to x coordinates 1, 2, ….
3500
3000
2500
2000
1500
1000
500
20 40 60 80 100
-259.14, —, 180.54, 1287., 2075., 3550., -210.1, -218.3, -219.6, -248.59, 97.72, 650., 660.32, 1414., 44.2, 115.21, -101.5, -189.3,
63.38, 842., 1541., 1668., 1910., 1907., 1246., 1538., 1495., 1455., 1084.62, 419.53, 29.76, 938.3, 817., 221., -7.3, -157.36,
39.31, 777., 1526., 1855., 2477., 2623., 2157., 2334., 1964., 1554.9, 961.78, 321.07, 156.6, 231.93, 630.63, 449.51, 113.7, -111.8,
28.44, 727., 920., 798., 931., 1021., 1.1 ´ 103 , 1072., 822., 1313., 1356., 1412., 1474., 1497., 1545., 819., 1663., 2233., 3017.,
3422., 3186., 3033., 2466., 1768.3, 1064.18, -38.83, 304., 327.46, 271.3, 254., 302., -71., —, 7.0 ´ 102 , 1050., 1750., 1572.,
1135., 644., 640., 1176., 1345., 1050., 900., 860., 1527., 827., 827., 1627., —, —, —, —, —, —, —, —, —, —, —, —, —, —, —
dataMeltingPointElement
TableElementDataz, "MeltingPoint", ElementDataz, z, 118
Data Visualization with Mathematica.03.nb 25
-259.14 Hydrogen
— Helium
180.54 Lithium
1287. Beryllium
2075. Boron
3550. Carbon
-210.1 Nitrogen
-218.3 Oxygen
-219.6 Fluorine
-248.59 Neon
97.72 Sodium
650. Magnesium
660.32 Aluminum
1414. Silicon
44.2 Phosphorus
115.21 Sulfur
-101.5 Chlorine
-189.3 Argon
63.38 Potassium
842. Calcium
1541. Scandium
1668. Titanium
1910. Vanadium
1907. Chromium
1246. Manganese
1538. Iron
1495. Cobalt
1455. Nickel
1084.62 Copper
419.53 Zinc
29.76 Gallium
938.3 Germanium
817. Arsenic
221. Selenium
-7.3 Bromine
-157.36 Krypton
26 Data Visualization with Mathematica.03.nb
-157.36 Krypton
39.31 Rubidium
777. Strontium
1526. Yttrium
1855. Zirconium
2477. Niobium
2623. Molybdenum
2157. Technetium
2334. Ruthenium
1964. Rhodium
1554.9 Palladium
961.78 Silver
321.07 Cadmium
156.6 Indium
231.93 Tin
630.63 Antimony
449.51 Tellurium
113.7 Iodine
-111.8 Xenon
28.44 Cesium
727. Barium
920. Lanthanum
798. Cerium
931. Praseodymium
1021. Neodymium
1.1 ´ 103 Promethium
1072. Samarium
822. Europium
1313. Gadolinium
1356. Terbium
1412. Dysprosium
1474. Holmium
1497. Erbium
1545. Thulium
819. Ytterbium
1663. Lutetium
2233. Hafnium
3017. Tantalum
3422. Tungsten
3186. Rhenium
3033. Osmium
2466. Iridium
1768.3 Platinum
1064.18 Gold
-38.83 Mercury
304. Thallium
327.46 Lead
Data Visualization with Mathematica.03.nb 27
271.3 Bismuth
254. Polonium
302. Astatine
-71. Radon
— Francium
7.0 ´ 102 Radium
1050. Actinium
1750. Thorium
1572. Protactinium
1135. Uranium
644. Neptunium
640. Plutonium
1176. Americium
1345. Curium
1050. Berkelium
900. Californium
860. Einsteinium
1527. Fermium
827. Mendelevium
827. Nobelium
1627. Lawrencium
— Rutherfordium
— Dubnium
— Seaborgium
— Bohrium
— Hassium
— Meitnerium
— Darmstadtium
— Roentgenium
— Ununbium
— Ununtrium
— Ununquadium
— Ununpentium
— Ununhexium
— Ununseptium
— Ununoctium
? Dimensions
DimensionsdataMeltingPointElement
118, 2
LengthdataMeltingPointElement
118
28 Data Visualization with Mathematica.03.nb
dataMeltingPointElement1
-259.14, Hydrogen
dataMeltingPointElement12
Hydrogen
3500
3000
2500
2000
1500
1000
500
20 40 60 80 100
Data Visualization with Mathematica.03.nb 29
Point °C
Melting
3500
3000
2500
2000
1500
1000
500
20 40 60 80
ListLinePlotdataMpBp
5000
4000
3000
2000
1000
ListPlotdataMpBp
5000
4000
3000
2000
1000
The data points can have tool tips with information when the mouse hovers over a data point.
? Tooltip
Tooltipexpr, label displays label as a tooltip while the mouse pointer is in the area where expr is displayed.
Data Visualization with Mathematica.03.nb 31
ListPlotTooltipdataMpBp
5000
4000
3000
2000
1000
ElementData"Properties"
-259.14 -252.87
— -268.93
180.54 1342.
1287. 2470.
2075. 4000.
3550. 4027.
-210.1 -195.79
-218.3 -182.9
32 Data Visualization with Mathematica.03.nb
-218.3 -182.9
-219.6 -188.12
-248.59 -246.08
97.72 883.
650. 1090.
660.32 2519.
1414. 2.9 ´ 103
44.2 280.5
115.21 444.72
-101.5 -34.04
-189.3 -185.8
63.38 759.
842. 1484.
1541. 2830.
1668. 3287.
1910. 3407.
1907. 2671.
1246. 2061.
1538. 2861.
1495. 2927.
1455. 2913.
1084.62 2927.
419.53 907.
29.76 2204.
938.3 2820.
817. 614.
221. 685.
-7.3 59.
-157.36 -153.22
39.31 688.
777. 1382.
1526. 3345.
1855. 4409.
2477. 4744.
2623. 4639.
2157. 4265.
2334. 4150.
1964. 3695.
1554.9 2963.
961.78 2162.
321.07 767.
156.6 2072.
231.93 2602.
630.63 1587.
449.51 988.
113.7 184.3
-111.8 -108.
Data Visualization with Mathematica.03.nb 33
-111.8 -108.
28.44 671.
727. 1870.
920. 3464.
798. 3360.
931. 3290.
1021. 3.1 ´ 103
1.1 ´ 103 3.0 ´ 103
1072. 1803.
822. 1527.
1313. 3250.
1356. 3230.
1412. 2567.
1474. 2700.
1497. 2868.
1545. 1950.
819. 1196.
1663. 3402.
2233. 4603.
3017. 5458.
3422. 5555.
3186. 5596.
3033. 5012.
2466. 4428.
1768.3 3825.
1064.18 2856.
-38.83 356.73
304. 1473.
327.46 1749.
271.3 1564.
254. 962.
302. —
-71. -61.7
— —
7.0 ´ 102 1737.
1050. 3200.
1750. 4820.
1572. 4000.
1135. 3927.
644. 4.0 ´ 103
640. 3230.
1176. 2011.
1345. 3110.
1050. —
900. —
860. —
1527.
34 Data Visualization with Mathematica.03.nb
1527. —
827. —
827. —
1627. —
— —
— —
— —
— —
— —
— —
— —
— —
— —
— —
— —
— —
— —
— —
— —
Manipulate
prop1, ElementData"Properties",
ListLogPlot, ListLogLinearPlot,
prop2, ElementData"Properties"
Data Visualization with Mathematica.03.nb 35
prop1 AtomicNumber
prop2 AtomicRadius
300
250
200
150
100
20 40 60 80
Plot the closing prices for Google stock since its initial public offering on August 19, 2004.
DateListPlot
TooltipFinancialData"GOOG", "August 19 2004", Joined True
700
600
500
400
300
200
100
2005 2006 2007 2008 2009 2010
This creates a plot comparing the closing stock price over the year 2006 for three companies: General Electric, Akamai, and
Microsoft.
36 Data Visualization with Mathematica.03.nb
60
50
40
30
20
10
AstronomicalData"Earth", "Image"
Make a graphic of solar system orbit paths with tooltips displaying images of each planet.
Data Visualization with Mathematica.03.nb 37
Meters
DateListPlot
1.5 ´ 1012
1.0 ´ 1012
5.0 ´ 1011
0
Jan Apr Jul Oct Jan
38 Data Visualization with Mathematica.03.nb
ProteinData"SP1", "MoleculePlot"
Import a PDB file.
Import"ExampleData1PPT.pdb"
Import a PDB file by setting various options.
Import"ExampleData1PPT.pdb", "Residues"
Gly Pro Ser Gln Pro Thr Tyr Pro Gly Asp Asp Ala Pro Val Glu Asp Leu Ile Arg Phe Tyr Asp Asn Leu Gln Gln
Import"ExampleDataaspirin.mol"
When importing a molfile that contains a 2 D representation of a molecule, Mathematica automatically renders it as a
chemical structure diagram.
Import "ExampleDatafluoxetine.mol"
This gives the atom types and their 2D coordinates for the structure diagram.
"VertexTypes", "VertexCoordinates"
Import"ExampleDatafluoxetine.mol",
-98.28, 75.86 -98.28, -7.24 -25.86, 117.59 -170.69, 117.59 -171.03, -48.97 -26.21, -48.97 46.21, 75.86 -242.41
C C O C C C C C
molstr
ExportString , "MOL", "VertexTypes", "VertexCoordinates"
40 Data Visualization with Mathematica.03.nb
22 0 0 0 0 999 V2000
M END
Data Visualization with Mathematica.03.nb 41
C, C, O, C, C, C, C, C, C, C, C, C, N, C, C, C, C, C, C, F, F, F
-98.28 75.86
-98.28 -7.24
-25.86 117.59
-170.69 117.59
-171.03 -48.97
-26.21 -48.97
46.21 75.86
-242.41 76.21
-171.03 -132.41
-26.21 -132.41
46.21 -7.24
118.28 117.59
-314.83 117.93
-98.28 -174.14
117.93 -48.97
190.35 75.86
-386.9 76.21
190.35 -7.59
262.41 -49.31
340. -86.9
297.24 9.66
221.72 -116.21
Initializations
sizeImageNotebook 200;