Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <meta charset="utf-8">

<script src=""></script>
<script src=""></script>
<script src=""></script>
  <script src=""></script>
  <script src="//"></script>
  <script src=""></script>

<body ng-app="PubNubAngularApp">
<h2>Map Subscriber (Receives Coordinates)</h2>
<div ng-controller="orthoCtrl" class="coords">
Current Coordinates:

//d3 script
var width = 960,
    height = 500;

//variables for transmission

var transmit1, receive1

var projection = d3.geo.orthographic()
    .translate([width / 2, height / 2])

var path = d3.geo.path()

var λ = d3.scale.linear()
    .domain([0, width])
    .range([-180, 180]);

var φ = d3.scale.linear()
    .domain([0, height])
    .range([90, -90]);

var svg ="body").append("svg")
    .attr("width", width)
    .attr("height", height);

d3.json("", function(error, world) {
      .attr("class", "land")
      .attr("d", path)

//PubNub Angular
angular.module('PubNubAngularApp', ["pubnub.angular.service"])
.controller('orthoCtrl', function($rootScope, $scope, $location, PubNub) {
  $scope.coords = "None Yet"

  // make up a channel name
  $  = 'orthoDemo';

  if (!$rootScope.initialized) {
    // Initialize the PubNub service
      publish_key   : 'demo',
      subscribe_key : 'demo'
    $rootScope.initialized = true;

  // Subscribe to the Channel
  PubNub.ngSubscribe({ channel: $ });

  // Register for message events
  $rootScope.$on(PubNub.ngMsgEv($, function(ngEvent, payload) {
    $scope.$apply(function() {
      $scope.coords = payload.message;
      p = $scope.coords;
      projection.rotate([λ(p[0]), φ(p[1])]);
      svg.selectAll("path").attr("d", path);




                h2 {
  font-family: Arial;
  color: #2d2d2d;

body {
  background-color: #9b9b9b;

.coords {
  color: #009;
  font-family: Arial;
  font-weight: strong;
  font-size: 1.2em;