首页 \ 问答 \ R中的螺旋图(Spiral Graph in R)

R中的螺旋图(Spiral Graph in R)

如何在R中创建螺旋图? 有没有用于这种分析的软件包? 或者有没有其他方式可视化时间导向的数据(关于周期性)?


How to create a spiral graph in R? Is there any package for this kind of analysis? Or is there any other way to visualize time oriented data (regarding periodicity)?


原文:https://stackoverflow.com/questions/6828350
更新时间:2023-04-20 22:04

最满意答案

为什么这张地图3的大小?

线条

   iss.str(line);
   iss >> word;
   word = fn1(word);
   mp[word] += 1;

只抓住一行的第一个单词并将其添加到地图中。 如果查看文本文件的第一个单词,则只有三个唯一单词。

我以为它会是14,计算文本文件中的每个单词。

尝试这个:

int main () {
   map<string, long> mp;
   string line, word;
   ifstream f_in("text.txt");
   while (getline(f_in, line)){

      // Construct this object inside the loop.
      // You don't need it outside this loop.
      istringstream iss(line);
      while ( iss >> word )
      {
         word = fn1(word);
         mp[word] += 1;
      }
   }
   std::cout << mp.size() << std::endl;
   return 0;
}

Why is the size of this map 3?

The lines

   iss.str(line);
   iss >> word;
   word = fn1(word);
   mp[word] += 1;

only grab the first word of a line and add it to the map. If you look at the first words of the text file, you only have three unique words.

I thought it would be 14, counting every word in the text file.

Try this:

int main () {
   map<string, long> mp;
   string line, word;
   ifstream f_in("text.txt");
   while (getline(f_in, line)){

      // Construct this object inside the loop.
      // You don't need it outside this loop.
      istringstream iss(line);
      while ( iss >> word )
      {
         word = fn1(word);
         mp[word] += 1;
      }
   }
   std::cout << mp.size() << std::endl;
   return 0;
}

相关问答

更多
  • 有几种选择: 您可以尝试使用statefull分配器的映射。 例如来自Boost.Container或C ++ 11。 或者,如果您接受非状态分配器的限制,那么您甚至可以使用C ++ 98/03中的映射。 考虑使用unordered_map(再次来自Boost或C ++ 11) - 它需要将存储区计为构造器参数。 它不同于map,因为它基于散列而不是严格的弱排序。 另一个选项是来自Boost的 flat_map。 它具有保留成员功能。 平面地图/集合的描述 : Boost.Container flat_ [ ...
  • 不要执行setup_map()函数。 window.onload = function() { //first setup the map, with our default location of London setup_map(51.5073509, -0.12775829999998223); document.getElementById("form").onsubmit = function() { //when form is submitted, wait for a callba ...
  • 我喜欢@ inflagranti的想法 - 所以,没有声称实用程序,这里是一个for-each模板,迭代所有东西。 它使用来自漂亮的打印机的is_container特性,我不在这里复制。 更新:现在已完全解决了裸值类型和对值类型的问题。 更新2:简化了实现类,感谢@Luc Danton。 #include #include "prettyprint.hpp" using namespace pretty_print; // for "is_container" trait ...
  • 为什么这张地图3的大小? 线条 iss.str(line); iss >> word; word = fn1(word); mp[word] += 1; 只抓住一行的第一个单词并将其添加到地图中。 如果查看文本文件的第一个单词,则只有三个唯一单词。 我以为它会是14,计算文本文件中的每个单词。 尝试这个: int main () { map mp; string line, word; ifstream f_in("text.txt") ...
  • 你的getA方法正在返回a的临时副本 ,因此你对setMap的调用正在修改该副本,而不是原始副本。 解决这个问题的一种方法是让getA返回一个引用或指向a的引用 Your getA method is returning a temporary copy of a, so your call to setMap is modifying that copy, not the original. One way to fix this would be to have getA return a refere ...
  • 你没有/不能对地图进行排序。 它们根据模板参数的可选第三个参数按键自动排序,模板参数是一个函数对象类,用于比较两个元素以确定哪个元素应该首先出现。 (如果第一个应该在第二个之前,它应该返回true,否则返回false) 所以你可以使用这样的东西: struct myCompare { bool operator() const (const map & lhs, const map & rhs) { return lhs.size() < ...
  • Leaflet中有两种圆圈: L.Circle和L.CircleMarker 。 L.Circle具有以米为单位指定的半径 ,而L.CircleMarker具有以像素为单位指定的半径 。 你的问题还不完全清楚(你的意思是“总是有相同的尺寸”吗?米还是像素?); 但我想你想用L.CircleMarker而不是L.Circle 。 There are two kinds of circles in Leaflet: L.Circle and L.CircleMarker. L.Circle has a radi ...
  • 我会以代码形式存储游戏地图。 每个节点代表一个国家/城市,每条边代表邻接。 一旦你有这样的地图,我相信你可以在网上找到许多有关人工智能(寻路,策略等)的资源。 如果您希望能够在程序中构建地图图像,请考虑为每个节点添加(x,y)坐标和图像。 这样,您可以在给定坐标处显示所有图像以建立地图视图。 I'd store a game map in code as a graph. Each node would represent a country/city and each edge would represe ...
  • 您的地图是方形大小,大多数设备都是矩形大小,因此您需要将地图保持在屏幕中心,无论是使用纵向还是横向模式。 public class TileTest extends ApplicationAdapter { ExtendViewport extendViewport; OrthogonalTiledMapRenderer mapRenderer; OrthographicCamera camera; float worldWidth,worldHeight; @O ...
  • 我不太确定你想要什么,但是当你添加scale_x_continuous和scale_y_continuous时,你可以使映射区域变小并“放大”到美国。 如果您对映射感兴趣,我建议您查看tmap( https://cran.r-project.org/web/packages/tmap/tmap.pdf )。 它也可以生成点图。 airports <- read.csv("http://bl.ocks.org/mbostock/raw/7608400/airports.csv", stringsAsFacto ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)