-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into new-display
- Loading branch information
Showing
22 changed files
with
619 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright 2013 PSF. Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 | ||
// File originates from the cpython source found in Doc/tools/sphinxext/static/version_switch.js | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
var doc_url = "www.pygmt.org"; | ||
//var doc_url = "0.0.0.0:8000"; // for local testing only | ||
var url_re = new RegExp(doc_url + "\\/(dev|latest|(v\\d+\\.\\d+\\.\\d+))\\/"); | ||
// List all versions. | ||
// Add one entry "version: title" for any minor releases | ||
var all_versions = { | ||
'latest': 'latest', | ||
'dev': 'dev', | ||
'v0.2.0': 'v0.2.0', | ||
'v0.1.2': 'v0.1.2', | ||
'v0.1.1': 'v0.1.1', | ||
'v0.1.0': 'v0.1.0', | ||
'0.0.1a0': 'v0.0.1a0', | ||
}; | ||
|
||
function build_select(current_version, current_release) { | ||
var buf = ['<select>']; | ||
|
||
$.each(all_versions, function(version, title) { | ||
buf.push('<option value="' + version + '"'); | ||
if (version == current_version) { | ||
buf.push(' selected="selected">'); | ||
if (version == "latest" || version == "dev") { | ||
buf.push(title + ' (' + current_release + ')'); | ||
} else { | ||
buf.push(current_version); | ||
} | ||
} else { | ||
buf.push('>' + title); | ||
} | ||
buf.push('</option>'); | ||
}); | ||
|
||
buf.push('</select>'); | ||
return buf.join(''); | ||
} | ||
|
||
function patch_url(url, new_version) { | ||
return url.replace(url_re, doc_url + '/' + new_version + '/'); | ||
} | ||
|
||
function on_switch() { | ||
var selected = $(this).children('option:selected').attr('value'); | ||
|
||
var url = window.location.href, | ||
new_url = patch_url(url, selected); | ||
|
||
if (new_url != url) { | ||
// check beforehand if url exists, else redirect to version's start page | ||
$.ajax({ | ||
url: new_url, | ||
success: function() { | ||
window.location.href = new_url; | ||
}, | ||
error: function() { | ||
window.location.href = 'http://' + doc_url + '/' + selected; | ||
} | ||
}); | ||
} | ||
} | ||
|
||
$(document).ready(function() { | ||
var match = url_re.exec(window.location.href); | ||
if (match) { | ||
var release = DOCUMENTATION_OPTIONS.VERSION; | ||
var version = match[1]; | ||
var select = build_select(version, release); | ||
$('.version_switch_note').html('Or, select a version from the drop-down menu above.'); | ||
$('.version').html(select); | ||
$('.version select').bind('change', on_switch); | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Lines | ||
----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
Line styles | ||
----------- | ||
The :meth:`pygmt.Figure.plot` method can plot lines in different styles. | ||
The default line style is a 0.25-point wide, black, solid line, and can be | ||
customized via the ``pen`` argument. | ||
A *pen* in GMT has three attributes: *width*, *color*, and *style*. | ||
The *style* attribute controls the appearance of the line. | ||
Giving “dotted” or “.” yields a dotted line, whereas a dashed pen is requested | ||
with “dashed” or “-”. Also combinations of dots and dashes, like “.-” for a | ||
dot-dashed line, are allowed. | ||
For more advanced *pen* attributes, see the GMT cookbook | ||
:gmt-docs:`cookbook/features.html#wpen-attrib`. | ||
""" | ||
|
||
import numpy as np | ||
import pygmt | ||
|
||
# Generate a sample line for plotting | ||
x = np.linspace(0, 10, 500) | ||
y = np.sin(x) | ||
|
||
fig = pygmt.Figure() | ||
fig.basemap(region=[0, 10, -3, 3], projection="X15c/8c", frame=["xaf", "yaf", "WSrt"]) | ||
|
||
# Plot the line using the default line style | ||
fig.plot(x=x, y=y) | ||
|
||
# Plot the lines using different line styles | ||
fig.plot(x=x, y=y + 1.5, pen="1p,red,-") | ||
fig.plot(x=x, y=y + 1.0, pen="2p,blue,.") | ||
fig.plot(x=x, y=y + 0.5, pen="1p,red,-.") | ||
|
||
fig.plot(x=x, y=y - 0.5, pen="2p,blue,..-") | ||
fig.plot(x=x, y=y - 1.0, pen="3p,tomato,--.") | ||
fig.plot(x=x, y=y - 1.5, pen="3p,tomato,4_2:2p") | ||
|
||
fig.show() |
Oops, something went wrong.