【Python】词云之 wordcloud库 全解析

2023-05-16

有用的话,欢迎姗莲✨✨✨✨✨✨✨✨✨✨✨✨✨

目录

  • 一基础用法
  • 二、WordCloud类 形参说明
    • 2.1 常用参数
      • 2.11 字体 font_path
      • 2.12 画布尺寸 width、hight
      • 2.13 比例(缩放)scale
      • 2.14 颜色(表) colormap
      • 2.15 颜色函数 color_func
      • 2.16 词语组合频率collocations
      • 2.17 遮罩(蒙版)mask
      • 2.18 轮廓宽度和颜色 contour_width、contour_color
    • 2.2~2.3 不常用参数
      • 2.21 词云边界 margin
      • 2.22 词语水平排版频率 prefer_horizontal
      • 2.23 显示词语的最大个数 max_words
      • 2.24 最小、最大字体大小 min_font_size 、max_font_size
      • 2.25 字体步长 font_step
      • 2.26 停用(屏蔽)词 stopwords
      • 2.27 背景色 background_color
      • 2.28 色彩模式 mode
      • 2.29 词语数量很少时重复 repeat
      • 2.30词语最短长度 min_word_length
      • 2.31 是否包含数字 include_numbers
      • 2.32 正则表达式 regexp
      • 2.33 单词搭配(词组) 出现最低频率 collocation_threshold
      • 2.34 单词复数转为单数 normalize_plurals
      • 2.35 词语相对大小 relative_scaling
      • 2.36 是否仅显示高频词 ranks_only
      • 2.37 随机生成器种子参数 random_state
  • 三、常用方法
    • 3.1 词云生成相关
      • 3.11 根据词频字典生成 fit_words()
      • 3.12 常用 generate()
      • 3.13 根据词频字典生成 generate_from_frequencies()
      • 3.14 根据文本生成generate_from_text()
      • 3.15 词频统计 process_text()
      • 3.16 单词重新上色 recolor()
    • 3.2 文件保存相关
      • 3.21 保存为数组 to_array
      • 3.22 保存为文件 to_file
      • 3.23 转换为PIL图像 to_image
      • 3.24 转换为SVG图像 to_svg
  • 四、关于词云背景图片
    • 4.1 将图片背景色转换为白色
    • 4.2 词云背景设置示例
  • 五、完整demo

以该视频的弹幕文件为例,我已保存为txt文件。

【4K60FPS】周杰伦《暗号》 神级现场!The one演唱会live

一基础用法

其中,self.Read_txt()是我的txt文本文件。

wd_0 = WordCloud(font_path='simhei.ttf',
                         # background_color='white',
                         colormap='autumn',
                         width=800,height=400,
                         collocations=True,
                         scale=4,
                         mask=mask_img).generate(self.Read_txt())
plt.imshow(wd_0,interpolation='bilinear')
plt.axis('off')
plt.show()

上面的代码已经可以生成一个清晰、有效的词云图像了。若要优化其他细节,可以参考下面的参数说明。

二、WordCloud类 形参说明

通过参数可以指定词云图像的字体、大小、配色等。

WordCloud这个类的全部参数如下:

WordCloud(font_path=None, width=400, height=200, margin=2, ranks_only=None, prefer_horizontal=0.9, mask=None, scale=1, color_func=None, max_words=200, min_font_size=4, stopwords=None, random_state=None, background_color=‘black’, max_font_size=None, font_step=1, mode=‘RGB’, relative_scaling=‘auto’, regexp=None, collocations=True, colormap=None, normalize_plurals=True, contour_width=0, contour_color=‘black’, repeat=False, include_numbers=False, min_word_length=0, collocation_threshold=30)

一般来说设置字体、尺寸、配色、缩放等少量几个参数就足够了。本文对WordCloud所有的形参进行说明。

2.1 常用参数

2.11 字体 font_path

 |  font_path : string
 |      Font path to the font that will be used (OTF or TTF).
 |      Defaults to DroidSansMono path on a Linux machine. If you are on
 |      another OS or don't have this font, you need to adjust this path.

设置示例:

font_path='simhei.ttf'

默认值:Linux的DroidSansMono 路径,一般windows是没有的,需要设置。

否则词云可能无法正确显示文字内容(类似于乱码),一般字体文件名为 name.ttf这种格式。
查看本机全部字体可以在:C:\Windows\Fonts路径下查看,或者从控制面板>外观和个性化>字体打开。

字体名称并不是仿宋、楷体这种,而是要在对应的字体上右键>属性,来查看其名称,如华文彩云这个字体的名称是:STCAIYUN.TTF

在这里插入图片描述

2.12 画布尺寸 width、hight

 |  width : int (default=400)
 |      Width of the canvas.
 |  
 |  height : int (default=200)
 |      Height of the canvas.

默认是400x200,单位:像素。

2.13 比例(缩放)scale

 |  scale : float (default=1)
 |      Scaling between computation and drawing. For large word-cloud images,
 |      using scale instead of larger canvas size is significantly faster, but
 |      might lead to a coarser fit for the words.

若画布设置为 400x200,若scale = 5,则词云图像的尺寸变成 2000x1000(像素)。

建议设置较小的画布尺寸,然后缩放成目标大小当然缩放系数要适当,太大也不合适

若直接将画布尺寸设置成2000x1000,虽然尺寸是一样的,但加载时间会比设置scale=5长很多.

词云的像素尺寸越大,越清晰,词频较低的字号很小的词语也能看清了。

2.14 颜色(表) colormap

 |  colormap : string or matplotlib colormap, default="viridis"
 |      Matplotlib colormap to randomly draw colors from for each word.
 |      Ignored if "color_func" is specified.
 |  
 |      .. versionadded: 2.0

colormap 是一个预定义的 Matplotlib colormap**。

默认值是:viridis。

一般我们使用matplotlib的colormap即可:

Matplotlib 提供了多种预定义的 colormap,如 viridis、 jet、 winter、 summer、 spring、
autumn、 cool、 hot、 gray 等

格式:

colormap = 'spring'

注:如果设置了color_func参数,则这一项失效。

2.15 颜色函数 color_func

 |  color_func : callable, default=None
 |      Callable with parameters word, font_size, position, orientation,
 |      font_path, random_state that returns a PIL color for each word.
 |      Overwrites "colormap".
 |      See colormap for specifying a matplotlib colormap instead.
 |      To create a word cloud with a single color, use
 |      ``color_func=lambda *args, **kwargs: "white"``.
 |      The single color can also be specified using RGB code. For example
 |      ``color_func=lambda *args, **kwargs: (255,0,0)`` sets color to red.

color_func 可以是一个预定义的函数,或者是一个自定义函数,用来确定每个词的颜色。

一般我们使用colormap这个参数就够了。

color_func示例:
设置词云颜色为白色:

color_func=lambda *args, **kwargs: "white"

2.16 词语组合频率collocations

 |  collocations : bool, default=True
 |      Whether to include collocations (bigrams) of two words. Ignored if using
 |      generate_from_frequencies.

collocations 是一个用来控制词云图像中词语组合频率的参数。当 collocations 被设置为 True 时,wordcloud 将会考虑两个词之间的关系来计算它们的频率。

建议设置为False

对比如下:

1. collocations=True
在这里插入图片描述

2.collocations=False
在这里插入图片描述

2.17 遮罩(蒙版)mask

 |  mask : nd-array or None (default=None)
 |      If not None, gives a binary mask on where to draw words. If mask is not
 |      None, width and height will be ignored and the shape of mask will be
 |      used instead. All white (#FF or #FFFFFF) entries will be considerd
 |      "masked out" while other entries will be free to draw on. [This
 |      changed in the most recent version!]

常常用来设置词云图像的形状,如果设置了mask,将由遮罩图像的尺寸来定义词云图像的尺寸。

mask的值是一个图像的二进制数据(矩阵),可用ndarray表示。

常常与2.18中的轮廓参数结合使用。

2.18 轮廓宽度和颜色 contour_width、contour_color

 |  contour_width: float (default=0)
 |      If mask is not None and contour_width > 0, draw the mask contour.
 |  
 |  contour_color: color value (default="black")
 |      Mask contour color.

遮罩(蒙版)图像的轮廓宽度和颜色。
如:

mask=mask_img,
contour_width= 10.0,
contour_color='blue',

在这里插入图片描述

2.2~2.3 不常用参数

2.21 词云边界 margin

默认值是2(像素)。

即词语显示区域距离整个图像边界的距离。

如果原始尺寸是 800x400,设置margin = 20,那么词云实际显示的区域大小为:760x360,图像大小不变,只是多了一个空白的边框。

这个参数再GUI相关的应用中基本都有,比如Android、微信小程序、前端、tkinter等等。

2.22 词语水平排版频率 prefer_horizontal

 |  prefer_horizontal : float (default=0.90)
 |      The ratio of times to try horizontal fitting as opposed to vertical.
 |      If prefer_horizontal < 1, the algorithm will try rotating the word
 |      if it doesn't fit. (There is currently no built-in way to get only
 |      vertical words.)

词语水平方向排版出现的频率,默认 0.9 ,这不用解释了吧。

2.23 显示词语的最大个数 max_words

 |  max_words : number (default=200)
 |      The maximum number of words.

这个参数有时候也会根据实际需求设置的。默认不超过200个。

2.24 最小、最大字体大小 min_font_size 、max_font_size

 |  min_font_size : int (default=4)
 |      Smallest font size to use. Will stop when there is no more room in this
 |      size.
 |  max_font_size : int or None (default=None)
 |      Maximum font size for the largest word. If None, height of the image is
 |      used.

一般不需要设置,最多设置一下最小字号。

2.25 字体步长 font_step

 |  font_step : int (default=1)
 |      Step size for the font. font_step > 1 might speed up computation but
 |      give a worse fit.

默认值即可。

2.26 停用(屏蔽)词 stopwords

 |  stopwords : set of strings or None
 |      The words that will be eliminated. If None, the build-in STOPWORDS
 |      list will be used. Ignored if using generate_from_frequencies.

要屏蔽的词,不设置则为内部默认的STOPWORDS。

2.27 背景色 background_color

 |  background_color : color value (default="black")
 |      Background color for the word cloud image.

图像背景色,十六进制或者英文名都可。

background_color='#450073',
# 或者
background_color='black',

2.28 色彩模式 mode

 |  mode : string (default="RGB")
 |      Transparent background will be generated when mode is "RGBA" and
 |      background_color is None.

默认是RGB色彩,如果设置为RGBA,并且背景色设置为None时,背景为透明
即:

mode='RGBA',
background_color=None,

2.29 词语数量很少时重复 repeat

 |  repeat : bool, default=False
 |      Whether to repeat words and phrases until max_words or min_font_size
 |      is reached.

比如默认显示200个词语,但我的文本只有50个词,是否选择重复显示这些词语,知道数量达到200。默认不开启。

2.30词语最短长度 min_word_length

 |  min_word_length : int, default=0
 |      Minimum number of letters a word must have to be included.

2.31 是否包含数字 include_numbers

 |  include_numbers : bool, default=False
 |      Whether to include numbers as phrases or not.

2.32 正则表达式 regexp

 |  regexp : string or None (optional)
 |      Regular expression to split the input text into tokens in process_text.
 |      If None is specified, ``r"\w[\w']+"`` is used. Ignored if using
 |      generate_from_frequencies.

可以用来过滤用于生成词云的单词,只允许那些符合模式的单词包括在内。例如,您可以使用正则表达式只包括以某个字母开头或包含特定字符序列的单词。这样,您可以专注于您想要在词云中强调的特定单词或短语,或排除某些不想包括的单词。正则表达式在词云中的具体实现将取决于使用的特定库或工具。

该参数,在一些特定应用中还是有用的。

2.33 单词搭配(词组) 出现最低频率 collocation_threshold

 |  collocation_threshold: int, default=30
 |      Bigrams must have a Dunning likelihood collocation score greater than this
 |      parameter to be counted as bigrams. Default of 30 is arbitrary.

搭配是一组经常一起出现在文本中的单词。collocation_threshold参数控制单词对一起出现的最小次数,以便被视为搭配。如果一对单词的频率低于collocation_threshold,则不会被视为搭配,并且不会包括在词云中。这个参数允许您关注文本中最频繁出现的搭配,并排除较不常见的搭配。

2.34 单词复数转为单数 normalize_plurals

 |  normalize_plurals : bool, default=True
 |      Whether to remove trailing 's' from words. If True and a word
 |      appears with and without a trailing 's', the one with trailing 's'
 |      is removed and its counts are added to the version without
 |      trailing 's' -- unless the word ends with 'ss'. Ignored if using
 |      generate_from_frequencies.

normalize_plurals参数是用于将复数单词规范化为单数形式的参数。当该参数设置为True时,词云生成工具会将所有出现的复数单词转换为单数形式,以便在词云中统计词频。例如,如果"dogs"和"dog"都出现在文本中,那么在normalize_plurals设置为True时,它们将被视为同一个单词"dog",并在词云中统计词频。这样可以减少不必要的单词数量,并使统计结果更具意义。

默认就开启这项功能的。

2.35 词语相对大小 relative_scaling

 |  relative_scaling : float (default='auto')
 |      Importance of relative word frequencies for font-size.  With
 |      relative_scaling=0, only word-ranks are considered.  With
 |      relative_scaling=1, a word that is twice as frequent will have twice
 |      the size.  If you want to consider the word frequencies and not only
 |      their rank, relative_scaling around .5 often looks good.
 |      If 'auto' it will be set to 0.5 unless repeat is true, in which
 |      case it will be set to 0.

用于控制词云中词语的相对大小的参数。这个参数的值越大,词语越大,反之越小。当relative_scaling设置为0时,所有单词的大小都相同,而当relative_scaling设置为1时,单词的大小与它们在文本中出现的频率成正比。该参数可以通过调整来更好地展示词云中词语的相对重要性

2.36 是否仅显示高频词 ranks_only

用于控制是否仅在词云中显示高频词的参数。当这个参数设置为True时,仅会在词云中显示高频词,而不会显示低频词。这样可以使词云更简洁,并且更容易看出文本中最重要的单词。当这个参数设置为False时,所有词都会被显示在词云中。

2.37 随机生成器种子参数 random_state

 |      random_state : RandomState, int, or None, default=None
 |          If not None, a fixed random state is used. If an int is given, this
 |          is used as seed for a random.Random state.

random_state参数是用于控制词云生成过程中随机数生成器种子的参数。这个参数可以用来确保词云在每次生成时都是相同的,这样可以在多次执行相同的词云生成代码时得到相同的结果。这对于评估不同的参数或算法的效果非常有用。如果未指定random_state,每次生成的词云都会有所不同。

如:

from wordcloud import WordCloud

text = "This is a sample text for generating a word cloud"
wc = WordCloud(random_state=42).generate(text)

三、常用方法

3.1 词云生成相关

通常使用generate()方法 就能生成词云了。这里还有其他几种生成词云的方式 。

3.11 根据词频字典生成 fit_words()

fit_words() 方法是在 WordCloud 类中的一个函数,它的作用是根据给定的词频字典来生成词云。词频字典是一个键值对的字典,其中键是单词,值是该单词的频率。

举例:

    frequencies = {'word1': 10, 'word2': 20, 'word3': 5}
    from wordcloud import WordCloud
    wordcloud = WordCloud(font_path='simhei.ttf').fit_words(frequencies)
    plt.imshow(wordcloud, interpolation='bilinear')
    plt.axis("off")
    plt.show()

在这里插入图片描述

3.12 常用 generate()

常用的词云生成方式。

3.13 根据词频字典生成 generate_from_frequencies()

它的作用是根据给定的词频字典来生成词云。词频字典是一个键值对的字典,其中键是单词,值是该单词的频率。 与 fit_words() 方法类似,但是 generate_from_frequencies() 方法是在生成词云之前预先配置词云的一个方法。

如:

frequencies = {'word1': 10, 'word2': 20, 'word3': 5}
from wordcloud import WordCloud
wordcloud = WordCloud().generate_from_frequencies(frequencies)

3.14 根据文本生成generate_from_text()

它的作用是根据给定的文本来生成词云。该文本可以是一个字符串或文件,它会先分析文本中的词汇并统计词频,然后根据词频生成词云。

如:

from wordcloud import WordCloud

with open('text.txt') as f:
    text = f.read()

wordcloud = WordCloud().generate_from_text(text)

或者直接使用字符串:

wordcloud = WordCloud().generate_from_text("This is a sample text for generating a wordcloud")

3.15 词频统计 process_text()

将文本分析成词频字典。该文本可以是一个字符串或文件,它会先分析文本中的词汇并统计词频。

如:

frequencies = WordCloud().process_text("This is a sample text for generating a wordcloud")
print(frequencies)

将输出:

{‘sample’: 1, ‘text’: 1, ‘generating’: 1, ‘wordcloud’: 1}

自动过滤了This 、a这些单词。

这个方法主要用来统计词语出现的频数。

3.16 单词重新上色 recolor()

  recolor(self, random_state=None, color_func=None, colormap=None)

不常用。

3.2 文件保存相关

3.21 保存为数组 to_array

 |  to_array(self)
 |      Convert to numpy array.
 |      
 |      Returns
 |      -------
 |      image : nd-array size (width, height, 3)
 |          Word cloud image as numpy matrix.

将WordCloud对象转换成一个numpy 数组。该数组表示 WordCloud 中每个词的大小和位置。

如:

wordcloud_array = wordcloud.to_array()

wordcloud_array 数组将包含所有词的位置和大小信息。

你可以使用numpy的shape属性来确认这个wordcloud_array的维度。

可以使用 matplotlib.pyplot.imshow() 来显示这个数组。

3.22 保存为文件 to_file

 |  to_file(self, filename)
 |      Export to image file.
 |      
 |      Parameters
 |      ----------
 |      filename : string
 |          Location to write to.
 |      
 |      Returns
 |      -------
 |      self

将 WordCloud 对象保存到一个文件中。它接受一个文件名作为参数,并将 WordCloud 图像保存到该文件中。默认情况下,图像将保存为 PNG 格式,但是也可以指定其他格式,如 JPEG 或 BMP。

如:

wd.to_file(f'2.PNG')

3.23 转换为PIL图像 to_image

 to_image(self)

将 WordCloud 对象转换为 PIL 图像。这意味着它会返回一个 PIL 图像对象, 而不是保存到文件中.

如:

image = wd.to_image()
image.show()

3.24 转换为SVG图像 to_svg

 |  to_svg(self, embed_font=False, optimize_embedded_font=True, embed_image=False)
 |      Export to SVG.

将 WordCloud 对象转换为 SVG (Scalable Vector Graphics) 格式。SVG 是一种矢量图形格式,可以在浏览器中显示并且可以缩放而不失真。
如:

    svg = wd.to_svg()
    with open("wordcloud.svg", "wb") as f:
        f.write(svg.encode())

即可生成SVG图像,双击即可在浏览器打开:
在这里插入图片描述

四、关于词云背景图片

需要白色背景图片,并且前景轮廓突出。这样效果最好。可以参考文末github仓库里面img/下面的图片示例。其中converted_img/目录下是已经转为白底的图片。

4.1 将图片背景色转换为白色

使用PIL库将图片转为白底的示例程序如下,本程序也支持透明底图片。

方法有很多,不限于此,只要是白底就好。

from PIL import Image
class Img_Convert:
    def __init__(self,img_name):
        self.name = img_name

    def img_convert(self):
        img = Image.open(fr'img/{self.name}')
        if img.mode != 'RGBA':
            img = img.convert('RGBA')
        width = img.width
        height = img.height
        img_new = Image.new('RGB',size=(width,height),color=(255,255,255))
        img_new.paste(img,(0,0),mask=img)
        # img_new.show()
        img_new.save(fr'img/converted_img/{self.name}','png')

if __name__ == '__main__':
    # z在这里填入原图名称(本程序的图片放在img/目录下)
    img_obj = Img_Convert('butterfly.png ')
    # 新生成的白底图片放在img/converted_img/目录下
    img_obj.img_convert()

4.2 词云背景设置示例

在词云中,使用PIL.Image.Open()函数打开白底图片,并将其转换为数组。

pic = np.array(Image.open("img/converted_img/1.png"))

在WordCloud类的形参中将mask设置为上面的图片即可:

wd = WordCloud(... mask = pic ...).genrate(text)

同时可以设置前景的轮廓线宽度和颜色,完整如:

    def wd_0(self):
        pic = np.array(Image.open("img/converted_img/1.png"))
        wd_0 = WordCloud(font_path='simhei.ttf',
                         background_color='black',
                         colormap='spring',
                         width=800, height=400,
                         collocations=False,
                         scale=3,
                         # min_font_size=1,
                         mask=pic,
                         contour_width=10.0,
                         contour_color='red',
                         ).generate(self.Read_txt())
        return wd_0

输出示例:

在这里插入图片描述

五、完整demo

txt等文件放在github了。

Addr:https://github.com/CQUPTLei/chatGPT_based

# -*- coding = utf-8 -*-
# @TIME :     2023-1-11 下午 3:06
# @Author :   CQUPTLei
# @File :     wordcloud_resolve.py
# @Software : PyCharm
# @Abstract : wordcloud参数解析与示例

import numpy as np
from wordcloud import WordCloud
import matplotlib.pyplot as plt
from PIL import Image
# import cv2

class WD(object):
    # 参数为要生成词云的txt文件名称
    def __init__(self, txt_name):
        self.txt = txt_name

    # 读取要生成词云的txt文件,我已经进行了分词、去除停用词等处理
    def Read_txt(self):
        with open(f'{self.txt}.txt', 'r', encoding='UTF-8') as f:
            dm = f.read()
            return dm

    # 词云制作
    def wd_0(self):
        pic = np.array(Image.open("img/converted_img/flower.png"))
        wd_0 = WordCloud(font_path='simhei.ttf',
                         background_color='black',
                         colormap='spring',
                         width=800, height=400,
                         collocations=False,
                         scale=3,
                         # min_font_size=1,
                         mask=pic,
                         contour_width=10.0,
                         contour_color='white',
                         ).generate(self.Read_txt())
        return wd_0

    # 词云展示
    @staticmethod
    def wd_show(wd):
        plt.imshow(wd, interpolation='bilinear')
        plt.axis("off")
        plt.show()


if __name__ == '__main__':
    dm_obj = WD('anhao_dm')
    # 选择一个例子生成词云
    wd = dm_obj.wd_0()
    wd.to_file(f'img/wd_output_img/out.PNG')
    dm_obj.wd_show(wd)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【Python】词云之 wordcloud库 全解析 的相关文章

  • windows下 Gitee(码云)使用

    1 注册Gitee并新建远程仓库2 初始化本地工作空间3 Git 全局设置 4 SSH公钥绑定5 提交文件到远程仓库 本文前提 xff1a 你已经在windows安装了git xff0c 如图所示 xff0c 关于git的安装 xff0c
  • 在 VS Code 中使用 Git

    1 VS Code安装2 在VS Code中登录Github账号3 Git 安装4 Git配置5 新建远程仓库并用命令行提交6 使用VSCode提交 1 VS Code安装 到vs code官网下载合适的版本并安装 2 在VS Code中登
  • 图像处理与机器视觉复习

    完整资源 xff1a GIthub链接 一 填空题 图像灰度均值 方差 图像的灰度平均值是平指灰度的平均水平 平均方差是衡量一个样本波动大小的量 xff0c 对图像来说 xff0c 平均方差反应的是图像高频部分的大小 方差小 xff0c 则
  • You-get && FFmpeg

    一 引言二 you get 介绍2 1 you get 安装2 2 you get语法及参数2 3 you get运用实例 三 FFmpeg介绍3 1 FFmpeg安装3 2 you get与FFmpeg的结合使用 四 HEVC 扩展 一
  • 一文读懂 主成分分析 与 因子分析

    2023 2 20更新 xff1a 修改了一些文字错误 xff0c 优化了排版 xff0c 增加了一些拓展内容 xff0c 祝大家学业有成 xff01 xff08 期待三连 x1f601 x1f601 xff09 目录 一 主成分分析二 因
  • Ubuntu 18.04 升级 20.04

    1 更换源2 安装所有更新包3 移除Ubuntu18 04上未用的旧包4 升级 鸿蒙开发要使用Ubuntu 20 04 及以上编译源码 xff0c 故将原来学习ROS 的Ubuntu18 04升级为20 04 1 更换源 好久没用这系统了
  • Ubuntu 20.04 update 报错 Problem executing scripts APT::Update

    报错内容 xff1a appstreamcli error span class token keyword while span loading shared libraries libxapian so 22 cannot span c
  • 解决Ubuntu20.04 开机黑屏光标闪烁进不去系统

    问题描述 xff1a 我是双系统 xff0c 原Ubuntu系统是18 04的 xff0c 使用命令行升级到20 04 xff0c 我搞到晚上2 xff1a 00 xff0c tnnd学校插座断电了 xff0c 大部分是升级好了 xff0c
  • 百度发布深度学习可视化平台 Visual DL

    恩威AI 科技评论消息 xff0c 1 月 16 日 xff0c 百度 ECharts 团队发布旗下知名开源产品 ECharts 的最新 4 0 版本 xff0c 并宣布品牌升级为 百度数据可视化实验室 xff08 http vis bai
  • VS Code SSH远程连接Ubuntu

    1 ubuntu设置 安装SSH服务并获取远程访问的IP地址 在Ubuntu系统中 xff0c Ctrl 43 Alt 43 T 打开终端工具 xff0c 执行如下命令安装SSH服务 说明 xff1a 如果执行该命令失败 xff0c 提示o
  • Ubuntu 20.04 根目录磁盘扩容(很快 很简单)

    1 下载安装GParted span class token function sudo span span class token function apt get span span class token function insta
  • Ubuntu创建pycharm快捷启动方式

    普通启动方式 xff1a 下载pycharm压缩包解压进入pycharm的bin目录下终端运行 sh pycharm sh 创建快捷启动方式 xff1a 终端输入 span class token function sudo span ge
  • Neptune w800初学 Ubuntu下程序编译与烧写

    一 hb学习1 1一些基本概念1 2构建流程1 3目录说明1 4使用说明 二 Neptune w800开发版实操2 1 准备工作2 1 1 示例工程下载2 1 2 编译1 编译工具链配置2 WiFIOT环境配置3 安装编译工具hb4 编译
  • Python安装 scons、pycryptodome等各种库很慢、安装失败

    本文方法适用于 绝大部分 python扩展库的安装 xff0c win Linux逗适用 原来 xff1a pip3 span class token function install span scons 报错 修改 xff1a pip3
  • Ubuntu 20.04 下VSCode编译并烧录openHarmony源码(Neptune w800开发版)

    昨天写过一篇文章 xff0c 是在命令行编译 xff0c 使用命令行串口工具minicom烧录的 有点小麻烦 推荐大家先试用上述方法试一试 xff0c 里面要安装的依赖也在文章里面 文章链接 鸿蒙Dev Device Tool本身就是VSC
  • Neptune w800点灯(中断)工程详解

    目录 一 鸿蒙项目简介1 1 项目构建1 1 1 什么是 Ninja xff1f 1 1 2 什么是gn 1 2 项目结构1 3 启动流程 二 点灯工程详解2 1 实现代码2 2 相关配置2 2 1 项目目录下BUILD gn2 2 2 a
  • Ubuntu(Linux)上安装微信(windows应用)

    本教程适用于大部分windows应用在ubuntu上安装 xff0c 很多软件还是不支持的 xff0c 比如游戏什么的 xff0c 我暂时没有尝试 目录 1 wine简介2 安装wine3 安装问题解决4 安装微信 1 wine简介 Win
  • Keil代码一键对齐工具

    1 下载AStyle工具2 Keil中配置3 效果展示4 扩展参数4 1 只格式化当前文件4 2 格式化整个工程4 3 参数说明 1 下载AStyle工具 下载链接 下载后将其放在合适的位置 xff0c 不用安装 我放在了keil安装目录下
  • 鸿蒙设备开发——Neptune w800 网络编程——按键控制WIFI连接状态

    目录 1 梗概与基础知识2 主要依赖3 主要函数解析3 1变参宏 日志打印3 2 PrintLinkedInfo 打印连到的接AP信息3 3 SecurityTypeName 返回AP加密方式 xff08 安全类型 xff09 3 4 Fo
  • 【前端】大数据时代的图表可视化利器——Highcharts,D3和百度的Echarts

    当你开始嫌弃Excel过于简单 xff0c 当你面对python和R的可视化工具包望而却步 xff0c 那么恭喜你 xff0c Echarts或Highcharts这两种基于浏览器渲染技术的纯JS框架 xff0c 就是你的不二选择 当然 x

随机推荐

  • I2C通信原理

    1 概述2 I2C总线的数据传送2 1 数据位的有效性规定2 2起始和终止信号2 3 数据传送格式2 3 1字节传送与应答2 3 2总线的寻址2 3 3数据帧格式 3 传输速率 1 概述 读法 xff1a 常用 xff1a I方C 标准 x
  • 红外通信的应用——PPM调制与解码(C51)

    目录 一 引言 红外线是波长在750nm至1mm之间的电磁波 xff0c 其频率高于微波而低于可见光 xff0c 是一种人的眼眼看不到的光线 无线电波和微波已被广泛应用在长距离的无线通信中 xff0c 但由于红外线的波长较短 xff0c 对
  • MATLAB提取不规则txt文件中的数值数据(简单且实用)

    目录 一 前情概要二 MATLAB导入数据2 1 数据加载2 2 设置分割符2 3 设置输出格式2 4 生成脚本或函数2 5 数据的进一步处理 一 前情概要 我的txt文本数据如图所示 xff08 部分 xff09 xff0c 是某地的地形
  • ArcGIS导入xyz序列并绘制地形图(含等高线、面体积、点距离的计算)

    目录 一 前情概要二 在ArcGIS中绘制地形图2 1 导入xyz数据并转换为table2 2 显示xyz数据2 3 创建TIN2 4 转为栅格数据2 5加载地形图 三 其他操作3 1 绘制等高线3 2 计算表面积3 3 计算目标点之间的距
  • 颜色编码 RGB、CMYK、 HEX

    一 RGB二 HEX三 CMYK 一 RGB RGB是通过对红 R xff09 绿 G 蓝 B 三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的 xff08 三原色的组合 xff09 RGB代码的表现形式为 xff08 x x
  • CDN(Content Delivery Network)内容分发网络从入门到与实战

    目录 一 简介二 加速原理三 应用场景3 1 网站加速3 2 文件下载加速3 3 点播加速3 4全站加速 四 一些基本概念五 实战5 1 开通CDN服务5 2 添加加速域名5 3 域名归属权验证5 4 配置CANME 一 简介 CDN xf
  • 腾讯云服务器修改为root登录安装宝塔面板

    目录 一 简介二 改为root登录三 修改云服务器名称四 安装宝塔面板 一 简介 之前用的香港服务器 xff0c 想换成大陆的 xff0c 买了腾讯云的服务器 和别的云稍有不同 xff0c 腾讯云服务器安装Linux服务器时 xff0c 登
  • 【最全】you-get和youtube-dl的安装和使用

    目录 一 ffmpeg you get youtube dl简介二 ffmpeg you get youtube dl安装2 1 安装2 2 配置 三 you get使用四 youtube dl使用4 1 常用选项 获取视频格式列表 下载指
  • 【WinSCP】强大的可视化远程文件传输 、管理工具 (支持多种协议,支持电脑与手机)

    目录 一 General二 下载三 简介四 连接服务器五 连接手机六 WinSCP支持的传输协议简介 一 General 以前开发网站的时候 xff0c 租了腾讯云的服务器 xff0c 远程登录服务器进行一些文件操作的方式有很多 xff0c
  • 【CSDN RSS订阅】将你的博客订阅至个人网站

    目录 一 前情提要二 RSS是什么 xff1f 三 将CSDN博客订阅至我的网站四 将 知乎每日精选 订阅到我的网站五 我不是程序员 xff0c 我怎么订阅5 1 RSS订阅地址5 2 RSS订阅器5 3 PC订阅实战 一 前情提要 查看我
  • Linux:查看网络信息和网络监控命令。

    ifconfig 该命令用于查看机器挂载的网卡情况 使用方式 ifconfig a 命令输出 可见机器有两个网卡 xff0c 一个时eth0 xff0c 另一个是本地回环虚拟网卡 另外 xff0c iproute2软件包含一个强大的网络配置
  • 【Google Colab】写代码(Python)有个浏览器就够了

    目录 一 Colab简介二 先用一下再说2 1 使用google硬盘2 2 使用colab 三 Colab常见问题3 1 Colab有什么使用限制3 2 文件怎么存储 共享3 3 代码在哪里执行3 4 怎么安装Python 库 一 Cola
  • 【输出重定向】Windows下 cmd 、powershell输出重定向

    目录 一 cmd和powershell二 什么是输入输出重定向三 语法及示例 一 cmd和powershell 大家如果只用过Windows xff0c 可能cmd接触的相对多一点 按win 43 r 输入cmd即可打开 我一般用的是pow
  • 【MATLAB】动态绘制曲线图(二维曲线)

    先看效果 主程序 xff1a 加载数据的部分我省略了 xff0c 就是data1这个矩阵 close all span class token punctuation span X span class token operator 61
  • 【猿如意】中的『格式工厂』工具详情介绍

    目录 一 什么是猿如意二 格式工厂简介三 通过猿如意获取格式工厂四 格式工厂使用技巧4 1 基础设置4 2 使用示例 五 格式工厂使用感受六 猿如意使用感受6 1 优点6 2 改进点 一 什么是猿如意 猿如意 是CSDN推出的一款桌面客户端
  • 【Anaconda】Navigator 无法从快捷方式打开(图标)

    一 问题描述 原来用的2020版的Anaconda xff1b 在AnacondaNavigator里面提示更新 xff0c 点击后更新非常慢 干脆把旧版卸载了 xff0c 安装2022最新版 但是安装后都不开Navigator xff0c
  • 【conda activate】命令激活以及conda常用命令

    目录 一 前情 xff1a 二 解决方法 xff1a 三 conda相关命令 xff1a 3 1与环境相关的命令3 1 与包相关的命令 一 前情 xff1a 使用conda创建虚拟环境后 xff0c 进入虚拟环境 xff0c 然后在虚拟环境
  • 【Quicker】您的指尖工具箱

    在日常学习和工作中我们常常用到各种各样的小工具 xff0c 比如 xff1a 截图并编辑 取色 文字识别 公式识别等等 倘若这每一项功能都下载一个程序 xff0c 则会显得非常冗杂 因此 xff0c 用一个工具箱将这些功能集合起来 xff0
  • 【Python】获取视频弹幕并生成词云

    目录 一 摘要二 获取目标视频cid三 获取视频弹幕xml文件四 处理弹幕文件五 生成词云六 完整参考代码 一 摘要 就是那个大家都用的弹幕视频网站 xff0c 不写名字了 xff0c 写了老是不能通过 获取视频的弹幕文件 xff08 xm
  • 【Python】词云之 wordcloud库 全解析

    有用的话 xff0c 欢迎姗莲 目录 一基础用法二 WordCloud类 形参说明2 1 常用参数2 11 字体 font path2 12 画布尺寸 width hight2 13 比例 xff08 缩放 xff09 scale2 14